标签:serve cli span style add 服务器维护 exp lod 服务
public function ip() { if (getenv(‘HTTP_CLIENT_IP‘)) { $ip = getenv(‘HTTP_CLIENT_IP‘); } elseif (getenv(‘HTTP_X_FORWARDED_FOR‘)) { $ip = getenv(‘HTTP_X_FORWARDED_FOR‘); } elseif (getenv(‘HTTP_X_FORWARDED‘)) { $ip = getenv(‘HTTP_X_FORWARDED‘); } elseif (getenv(‘HTTP_FORWARDED_FOR‘)) { $ip = getenv(‘HTTP_FORWARDED_FOR‘); } elseif (getenv(‘HTTP_FORWARDED‘)) { $ip = getenv(‘HTTP_FORWARDED‘); } else { $ip = $_SERVER[‘REMOTE_ADDR‘]; } return explode(‘,‘,$ip); }
$arr = array(‘43.241.10.171‘,‘113.87.131.156‘,‘122.228.238.72‘); if(in_array($ip,$arr)){ exit(‘服务器维护..‘); }
标签:serve cli span style add 服务器维护 exp lod 服务
原文地址:http://www.cnblogs.com/wesky/p/7977870.html