Explorar o código

更新 'application/index/controller/Base.php'

增加apache本地地址条件
Me %!s(int64=5) %!d(string=hai) anos
pai
achega
c4ceb385bb
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      application/index/controller/Base.php

+ 1 - 1
application/index/controller/Base.php

@@ -34,7 +34,7 @@ class Base extends Controller
 
  		$getip = getIp();//获取ip
         // $getip = "218.70.26.255"; //重庆IP地址
-        if($getip == ''||$getip=='127.0.0.1'){
+        if($getip == ''||$getip=='127.0.0.1'||$getip=='::1'){//nginx环境为本地ip为127.0.0.1,apache本地环境为::1
             $getip="210.51.167.169";//默认为北京ip地址
         }
         $content = json_decode(file_get_contents("https://api.seniverse.com/v3/weather/now.json?key=S3OSd1xyPevThEbnB&location=$getip"),true);