@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library |
18 | 18 | // +---------------------------------------------------------------------- |
19 | 19 | |
20 | -declare (strict_types=1); |
|
20 | +declare(strict_types=1); |
|
21 | 21 | |
22 | 22 | namespace DtApp\ThinkLibrary\helper; |
23 | 23 | |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | 'openwave', 'nexusone', 'cldc', 'midp', 'wap', 'mobile', 'alipay' |
130 | 130 | ]; |
131 | 131 | // 从HTTP_USER_AGENT中查找手机浏览器的关键字 |
132 | - if (preg_match("/(" . implode('|', $clientkeywords) . ")/i", strtolower(request()->server('HTTP_USER_AGENT')))) { |
|
132 | + if (preg_match("/(".implode('|', $clientkeywords).")/i", strtolower(request()->server('HTTP_USER_AGENT')))) { |
|
133 | 133 | return true; |
134 | 134 | } |
135 | 135 | } |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | $agent = strtolower(request()->server('HTTP_USER_AGENT')); |
202 | 202 | if (strpos($agent, 'iphone') || strpos($agent, 'ipad') || strpos($agent, 'android')) { |
203 | 203 | $type = 'mobile'; |
204 | - } else { |
|
204 | + }else { |
|
205 | 205 | $type = 'computer'; |
206 | 206 | } |
207 | 207 | return $type; |
@@ -231,6 +231,6 @@ discard block |
||
231 | 231 | public function getWebsiteAddress(): string |
232 | 232 | { |
233 | 233 | $http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://'; |
234 | - return $http_type . $_SERVER['HTTP_HOST'] . "/"; |
|
234 | + return $http_type.$_SERVER['HTTP_HOST']."/"; |
|
235 | 235 | } |
236 | 236 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library |
18 | 18 | // +---------------------------------------------------------------------- |
19 | 19 | |
20 | -declare (strict_types=1); |
|
20 | +declare(strict_types=1); |
|
21 | 21 | |
22 | 22 | namespace DtApp\ThinkLibrary\helper; |
23 | 23 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $buff = ""; |
65 | 65 | foreach ($data as $k => $v) { |
66 | 66 | if ($k != "sign" && $v !== "" && !is_array($v)) { |
67 | - $buff .= $k . "=" . $v . "&"; |
|
67 | + $buff .= $k."=".$v."&"; |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | $buff = trim($buff, "&"); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library |
18 | 18 | // +---------------------------------------------------------------------- |
19 | 19 | |
20 | -declare (strict_types=1); |
|
20 | +declare(strict_types=1); |
|
21 | 21 | |
22 | 22 | namespace DtApp\ThinkLibrary\helper; |
23 | 23 | |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | $dh = opendir($name); |
68 | 68 | while ($file = readdir($dh)) { |
69 | 69 | if ($file != "." && $file != "..") { |
70 | - $fullpath = $name . "/" . $file; |
|
70 | + $fullpath = $name."/".$file; |
|
71 | 71 | if (!is_dir($fullpath)) { |
72 | 72 | unlink($fullpath); |
73 | - } else { |
|
73 | + }else { |
|
74 | 74 | $this->deletes($fullpath); |
75 | 75 | } |
76 | 76 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | if (empty($name)) { |
98 | 98 | throw new DtaException('请检查需要打包的路径名称'); |
99 | 99 | } |
100 | - $list = glob($name . "{$file_name}.{$suffix_name}"); |
|
100 | + $list = glob($name."{$file_name}.{$suffix_name}"); |
|
101 | 101 | $fileList = $list; |
102 | 102 | $zip = new ZipArchive(); |
103 | 103 | // 打开压缩包 |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | { |
121 | 121 | $files = []; |
122 | 122 | if (is_dir($path)) { |
123 | - $path = dirname($path) . '/' . basename($path) . '/'; |
|
123 | + $path = dirname($path).'/'.basename($path).'/'; |
|
124 | 124 | $file = dir($path); |
125 | 125 | while (false !== ($entry = $file->read())) { |
126 | 126 | if ($entry !== '.' && $entry !== '..') { |
127 | - $cur = $path . $entry; |
|
127 | + $cur = $path.$entry; |
|
128 | 128 | if (is_dir($cur)) { |
129 | - $subPath = $cur . '/'; |
|
129 | + $subPath = $cur.'/'; |
|
130 | 130 | $this->getFiles($subPath); |
131 | 131 | } |
132 | 132 | $files[] = $cur; |
@@ -17,7 +17,7 @@ |
||
17 | 17 | // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library |
18 | 18 | // +---------------------------------------------------------------------- |
19 | 19 | |
20 | -declare (strict_types=1); |
|
20 | +declare(strict_types=1); |
|
21 | 21 | |
22 | 22 | namespace DtApp\ThinkLibrary\helper; |
23 | 23 |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | // | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library |
18 | 18 | // +---------------------------------------------------------------------- |
19 | 19 | |
20 | -declare (strict_types=1); |
|
20 | +declare(strict_types=1); |
|
21 | 21 | |
22 | 22 | namespace DtApp\ThinkLibrary\helper; |
23 | 23 | |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | $charset = array_merge($lowerLetter, $upperLetter); |
59 | 59 | } elseif ($type == 7) { |
60 | 60 | $charset = array_merge($number, $lowerLetter, $upperLetter); |
61 | - } else { |
|
61 | + }else { |
|
62 | 62 | $charset = $number; |
63 | 63 | } |
64 | 64 | $str = ''; |
65 | 65 | // 生成字符串 |
66 | 66 | for ($i = 0; $i < $length; $i++) { |
67 | - $str .= $charset[random_int(0, count($charset) - 1)]; |
|
67 | + $str .= $charset[random_int(0, count($charset)-1)]; |
|
68 | 68 | // 验证规则 |
69 | 69 | if ($type == 4 && strlen($str) >= 2) { |
70 | 70 | if (!preg_match('/\d+/', $str) || !preg_match('/[a-z]+/', $str)) { |