Files
ipcheck/app/controller/Index.php
T
2022-07-06 10:28:26 +08:00

21 lines
367 B
PHP

<?php
namespace app\controller;
use itbdw\Ip\IpLocation;
use support\Request;
class Index
{
public function index(Request $request)
{
$ip = $request->getRealIp();
$filepath = '/usr/src/myapp/lib/qqwry.dat';
$location = IpLocation::getLocation($ip, $filepath);
return json(['ip' => $ip, 'location' => $location]);
}
}