diff --git a/app/controller/Index.php b/app/controller/Index.php index f2b9660..16f1ea4 100644 --- a/app/controller/Index.php +++ b/app/controller/Index.php @@ -7,12 +7,12 @@ use support\Request; class Index { - public function index(Request $request) + public function index(Request $request, $checkIp = null) { $ip = $request->getRealIp(); - if ($check = $request->get('ip')) { - $ip = gethostbyname($check); + if ($checkIp) { + $ip = gethostbyname($checkIp); } $filepath = '/usr/src/myapp/lib/qqwry.dat'; diff --git a/config/route.php b/config/route.php index 87e44a5..a319f27 100644 --- a/config/route.php +++ b/config/route.php @@ -17,6 +17,9 @@ use Webman\Route; Route::any('/', [\app\controller\Index::class, 'index']); +Route::any('/check[/{ip}]', [\app\controller\Index::class, 'index']); + +