Selaa lähdekoodia

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

增加apache本地地址条件
Me 5 vuotta sitten
vanhempi
commit
c4ceb385bb
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  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);