@@ -44,7 +44,7 @@ |
||
| 44 | 44 | $this->name = trim($input->getArgument('name')); |
| 45 | 45 | if (empty($this->name)) { |
| 46 | 46 | $this->output->writeln('name of online installation cannot be empty'); |
| 47 | - } else { |
|
| 47 | + }else { |
|
| 48 | 48 | $this->output->writeln("The specified module {$this->name} is not configured with installation rules"); |
| 49 | 49 | } |
| 50 | 50 | } |
@@ -34,6 +34,6 @@ |
||
| 34 | 34 | |
| 35 | 35 | protected function execute(Input $input, Output $output) |
| 36 | 36 | { |
| 37 | - $output->writeln('ThinkPHP ' . App::VERSION); |
|
| 37 | + $output->writeln('ThinkPHP '.App::VERSION); |
|
| 38 | 38 | } |
| 39 | 39 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | |
| 20 | 20 | return [ |
| 21 | 21 | // IP数据库文件存放位置 |
| 22 | - 'ip_path' => app()->getRuntimePath() . 'dtapp/ip/', |
|
| 22 | + 'ip_path' => app()->getRuntimePath().'dtapp/ip/', |
|
| 23 | 23 | // 淘宝 |
| 24 | 24 | 'taobao' => [ |
| 25 | 25 | // 淘宝客 |
@@ -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 | |
@@ -55,36 +55,36 @@ discard block |
||
| 55 | 55 | $charset = array_merge($lowerLetter, $upperLetter); |
| 56 | 56 | } elseif ($type == 7) { |
| 57 | 57 | $charset = array_merge($number, $lowerLetter, $upperLetter); |
| 58 | - } else { |
|
| 58 | + }else { |
|
| 59 | 59 | $charset = $number; |
| 60 | 60 | } |
| 61 | 61 | $str = ''; |
| 62 | 62 | // 生成字符串 |
| 63 | 63 | for ($i = 0; $i < $length; $i++) { |
| 64 | - $str .= $charset[mt_rand(0, count($charset) - 1)]; |
|
| 64 | + $str .= $charset[mt_rand(0, count($charset)-1)]; |
|
| 65 | 65 | // 验证规则 |
| 66 | 66 | if ($type == 4 && strlen($str) >= 2) { |
| 67 | 67 | if (!preg_match('/\d+/', $str) || !preg_match('/[a-z]+/', $str)) { |
| 68 | 68 | $str = substr($str, 0, -1); |
| 69 | - $i = $i - 1; |
|
| 69 | + $i = $i-1; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | if ($type == 5 && strlen($str) >= 2) { |
| 73 | 73 | if (!preg_match('/\d+/', $str) || !preg_match('/[A-Z]+/', $str)) { |
| 74 | 74 | $str = substr($str, 0, -1); |
| 75 | - $i = $i - 1; |
|
| 75 | + $i = $i-1; |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | if ($type == 6 && strlen($str) >= 2) { |
| 79 | 79 | if (!preg_match('/[a-z]+/', $str) || !preg_match('/[A-Z]+/', $str)) { |
| 80 | 80 | $str = substr($str, 0, -1); |
| 81 | - $i = $i - 1; |
|
| 81 | + $i = $i-1; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | if ($type == 7 && strlen($str) >= 3) { |
| 85 | 85 | if (!preg_match('/\d+/', $str) || !preg_match('/[a-z]+/', $str) || !preg_match('/[A-Z]+/', $str)) { |
| 86 | 86 | $str = substr($str, 0, -2); |
| 87 | - $i = $i - 2; |
|
| 87 | + $i = $i-2; |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -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 | |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | $dh = opendir($name); |
| 66 | 66 | while ($file = readdir($dh)) { |
| 67 | 67 | if ($file != "." && $file != "..") { |
| 68 | - $fullpath = $name . "/" . $file; |
|
| 68 | + $fullpath = $name."/".$file; |
|
| 69 | 69 | if (!is_dir($fullpath)) { |
| 70 | 70 | unlink($fullpath); |
| 71 | - } else { |
|
| 71 | + }else { |
|
| 72 | 72 | $this->deletes($fullpath); |
| 73 | 73 | } |
| 74 | 74 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | //删除当前文件夹: |
| 78 | 78 | if (rmdir($name)) { |
| 79 | 79 | return true; |
| 80 | - } else { |
|
| 80 | + }else { |
|
| 81 | 81 | return false; |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | try { |
| 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 | // 打开压缩包 |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | $files = []; |
| 125 | 125 | if (is_dir($path)) { |
| 126 | - $path = dirname($path) . '/' . basename($path) . '/'; |
|
| 126 | + $path = dirname($path).'/'.basename($path).'/'; |
|
| 127 | 127 | $file = dir($path); |
| 128 | 128 | while (false !== ($entry = $file->read())) { |
| 129 | 129 | if ($entry !== '.' && $entry !== '..') { |
| 130 | - $cur = $path . $entry; |
|
| 130 | + $cur = $path.$entry; |
|
| 131 | 131 | if (is_dir($cur)) { |
| 132 | - $subPath = $cur . '/'; |
|
| 132 | + $subPath = $cur.'/'; |
|
| 133 | 133 | $this->getFiles($subPath); |
| 134 | 134 | } |
| 135 | 135 | $files[] = $cur; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | $file->close(); |
| 139 | 139 | return $files; |
| 140 | - } else { |
|
| 140 | + }else { |
|
| 141 | 141 | return []; |
| 142 | 142 | } |
| 143 | 143 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | return false; |
| 155 | 155 | } elseif (empty($files)) { |
| 156 | 156 | return false; |
| 157 | - } else { |
|
| 157 | + }else { |
|
| 158 | 158 | foreach ($files as $item => $file) { |
| 159 | 159 | if (is_dir($file)) { |
| 160 | 160 | rmdir($file); |
@@ -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 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function isEvenNumbers(int $num): bool |
| 37 | 37 | { |
| 38 | - if ($num % 2 == 0) { |
|
| 38 | + if ($num%2 == 0) { |
|
| 39 | 39 | return true; |
| 40 | 40 | } |
| 41 | 41 | return false; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | public function isOddNumbers(int $num): bool |
| 50 | 50 | { |
| 51 | - if ($num % 2 == 0) { |
|
| 51 | + if ($num%2 == 0) { |
|
| 52 | 52 | return false; |
| 53 | 53 | } |
| 54 | 54 | return true; |
@@ -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 | |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | if (!isset($array) || empty($array)) { |
| 61 | 61 | return $arrRet; |
| 62 | 62 | } |
| 63 | - $iCount = count($array) / $num; |
|
| 63 | + $iCount = count($array)/$num; |
|
| 64 | 64 | if (!is_int($iCount)) { |
| 65 | 65 | $iCount = ceil($iCount); |
| 66 | - } else { |
|
| 66 | + }else { |
|
| 67 | 67 | $iCount += 1; |
| 68 | 68 | } |
| 69 | 69 | for ($i = 0; $i < $iCount; ++$i) { |
| 70 | - $arrInfos = array_slice($array, $i * $num, $num); |
|
| 70 | + $arrInfos = array_slice($array, $i*$num, $num); |
|
| 71 | 71 | if (empty($arrInfos)) { |
| 72 | 72 | continue; |
| 73 | 73 | } |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | foreach ($arrays as $array) { |
| 110 | 110 | if (is_array($array)) { |
| 111 | 111 | $key_arrays[] = $array[$sort_key]; |
| 112 | - } else { |
|
| 112 | + }else { |
|
| 113 | 113 | return []; |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | - } else { |
|
| 116 | + }else { |
|
| 117 | 117 | return []; |
| 118 | 118 | } |
| 119 | 119 | array_multisort($key_arrays, $sort_order, $sort_type, $arrays); |
@@ -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 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | header('Content-Type:application/json; charset=utf-8'); |
| 44 | 44 | if (!empty($ext) && is_array($ext)) { |
| 45 | 45 | throw new HttpResponseException(json(array_merge(['code' => $code, 'msg' => $msg, 'time' => time(), 'data' => $data], $ext))); |
| 46 | - } else { |
|
| 46 | + }else { |
|
| 47 | 47 | throw new HttpResponseException(json(['code' => $code, 'msg' => $msg, 'time' => time(), 'data' => $data])); |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | header('Content-Type:application/json; charset=utf-8'); |
| 62 | 62 | if (!empty($ext) && is_array($ext)) { |
| 63 | 63 | throw new HttpResponseException(json(array_merge(['code' => $code, 'msg' => $msg, 'time' => time(), 'data' => $data], $ext))); |
| 64 | - } else { |
|
| 64 | + }else { |
|
| 65 | 65 | throw new HttpResponseException(json(['code' => $code, 'msg' => $msg, 'time' => time(), 'data' => $data])); |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -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 | } |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | if (strpos(request()->server('HTTP_USER_AGENT'), 'QQ') !== false) { |
| 204 | 204 | if (strpos(request()->server('HTTP_USER_AGENT'), '_SQ_') !== false) { |
| 205 | 205 | return false; |
| 206 | - } else { |
|
| 206 | + }else { |
|
| 207 | 207 | return true; |
| 208 | 208 | } |
| 209 | 209 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $agent = strtolower(request()->server('HTTP_USER_AGENT')); |
| 220 | 220 | if (strpos($agent, 'iphone') || strpos($agent, 'ipad') || strpos($agent, 'android')) { |
| 221 | 221 | $type = 'mobile'; |
| 222 | - } else { |
|
| 222 | + }else { |
|
| 223 | 223 | $type = 'computer'; |
| 224 | 224 | } |
| 225 | 225 | return $type; |
@@ -249,6 +249,6 @@ discard block |
||
| 249 | 249 | public function getWebsiteAddress(): string |
| 250 | 250 | { |
| 251 | 251 | $http_type = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https')) ? 'https://' : 'http://'; |
| 252 | - return $http_type . $_SERVER['HTTP_HOST'] . "/"; |
|
| 252 | + return $http_type.$_SERVER['HTTP_HOST']."/"; |
|
| 253 | 253 | } |
| 254 | 254 | } |