From e81e23e0f1afa4044190cab16d0670c13a9f5f73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cwanyongkang=E2=80=9D?= <“937888580@qq.com”> Date: Fri, 16 May 2025 18:29:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0ip=E6=9F=A5=E8=AF=A2=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/Index.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/api/controller/Index.php b/app/api/controller/Index.php index 2c1a8a0..d673487 100644 --- a/app/api/controller/Index.php +++ b/app/api/controller/Index.php @@ -36,4 +36,17 @@ class Index extends Controller ]; echo json_encode($data); } + + public function getIpAddress() + { + if(!$_GET){ + die; + } + $ip = $_GET['ip']; + + $cip_content = json_decode(file_get_contents('https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php?co=&resource_id=6006&oe=utf8&query='.$ip),true); + + \result($cip_content['data'][0]['location']); + + } } \ No newline at end of file