@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * Description: Tool.php. |
9 | 9 | */ |
10 | 10 | |
11 | -class Tool{ |
|
11 | +class Tool { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * Description: 获取ip |
@@ -16,14 +16,14 @@ discard block |
||
16 | 16 | * Updater: |
17 | 17 | * @return string |
18 | 18 | */ |
19 | - public static function getIp(){ |
|
20 | - if(!empty($_SERVER["HTTP_CLIENT_IP"])){ |
|
19 | + public static function getIp() { |
|
20 | + if (!empty($_SERVER["HTTP_CLIENT_IP"])) { |
|
21 | 21 | $cip = $_SERVER["HTTP_CLIENT_IP"]; |
22 | - }else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"])){ |
|
22 | + } else if (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) { |
|
23 | 23 | $cip = $_SERVER["HTTP_X_FORWARDED_FOR"]; |
24 | - }else if(!empty($_SERVER["REMOTE_ADDR"])){ |
|
24 | + } else if (!empty($_SERVER["REMOTE_ADDR"])) { |
|
25 | 25 | $cip = $_SERVER["REMOTE_ADDR"]; |
26 | - }else{ |
|
26 | + } else { |
|
27 | 27 | $cip = ''; |
28 | 28 | } |
29 | 29 | preg_match("/[\d\.]{7,15}/", $cip, $cips); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | * Updater: |
40 | 40 | * @return string |
41 | 41 | */ |
42 | - public static function getOrigin(){ |
|
42 | + public static function getOrigin() { |
|
43 | 43 | $origin = ''; |
44 | 44 | if (isset($_SERVER['HTTP_X_ORIGINAL_FOR'])) { |
45 | 45 | $origin = $_SERVER['HTTP_X_ORIGINAL_FOR']; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | 'mobile' |
105 | 105 | ); |
106 | 106 | // 从HTTP_USER_AGENT中查找手机浏览器的关键字 |
107 | - if (preg_match("/(" . implode('|', $clientKeyWords) . ")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) { |
|
107 | + if (preg_match("/(".implode('|', $clientKeyWords).")/i", strtolower($_SERVER['HTTP_USER_AGENT']))) { |
|
108 | 108 | return true; |
109 | 109 | } |
110 | 110 | } |