@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: yangweijie <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | namespace think\debug; |
13 | 13 | |
14 | 14 | use think\App; |
@@ -52,21 +52,21 @@ discard block |
||
52 | 52 | $mem = number_format((memory_get_usage() - $app->getBeginMem()) / 1024, 2); |
53 | 53 | |
54 | 54 | if ($request->host()) { |
55 | - $uri = $request->protocol() . ' ' . $request->method() . ' : ' . $request->url(true); |
|
55 | + $uri = $request->protocol().' '.$request->method().' : '.$request->url(true); |
|
56 | 56 | } else { |
57 | - $uri = 'cmd:' . implode(' ', $_SERVER['argv']); |
|
57 | + $uri = 'cmd:'.implode(' ', $_SERVER['argv']); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // 页面Trace信息 |
61 | 61 | $base = [ |
62 | - '请求信息' => date('Y-m-d H:i:s', $request->time()) . ' ' . $uri, |
|
63 | - '运行时间' => number_format((float) $runtime, 6) . 's [ 吞吐率:' . $reqs . 'req/s ] 内存消耗:' . $mem . 'kb 文件加载:' . count(get_included_files()), |
|
64 | - '查询信息' => $app->db->getQueryTimes() . ' queries', |
|
65 | - '缓存信息' => $app->cache->getReadTimes() . ' reads,' . $app->cache->getWriteTimes() . ' writes', |
|
62 | + '请求信息' => date('Y-m-d H:i:s', $request->time()).' '.$uri, |
|
63 | + '运行时间' => number_format((float) $runtime, 6).'s [ 吞吐率:'.$reqs.'req/s ] 内存消耗:'.$mem.'kb 文件加载:'.count(get_included_files()), |
|
64 | + '查询信息' => $app->db->getQueryTimes().' queries', |
|
65 | + '缓存信息' => $app->cache->getReadTimes().' reads,'.$app->cache->getWriteTimes().' writes', |
|
66 | 66 | ]; |
67 | 67 | |
68 | 68 | if ($app->session->getId(false)) { |
69 | - $base['会话信息'] = 'SESSION_ID=' . $app->session->getId(); |
|
69 | + $base['会话信息'] = 'SESSION_ID='.$app->session->getId(); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | $info = $this->getFileInfo(); |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | case '调试': |
126 | 126 | $var_type = gettype($m); |
127 | 127 | if (in_array($var_type, ['array', 'string'])) { |
128 | - $line[] = "console.log(" . json_encode($m) . ");"; |
|
128 | + $line[] = "console.log(".json_encode($m).");"; |
|
129 | 129 | } else { |
130 | - $line[] = "console.log(" . json_encode(var_export($m, true)) . ");"; |
|
130 | + $line[] = "console.log(".json_encode(var_export($m, true)).");"; |
|
131 | 131 | } |
132 | 132 | break; |
133 | 133 | case '错误': |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | $line[] = "console.log(\"%c{$msg}\", \"{$style}\");"; |
142 | 142 | break; |
143 | 143 | default: |
144 | - $m = is_string($key) ? $key . ' ' . $m : $key + 1 . ' ' . $m; |
|
144 | + $m = is_string($key) ? $key.' '.$m : $key + 1.' '.$m; |
|
145 | 145 | $msg = json_encode($m); |
146 | 146 | $line[] = "console.log({$msg});"; |
147 | 147 | break; |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | $info = []; |
163 | 163 | |
164 | 164 | foreach ($files as $key => $file) { |
165 | - $info[] = $file . ' ( ' . number_format(filesize($file) / 1024, 2) . ' KB )'; |
|
165 | + $info[] = $file.' ( '.number_format(filesize($file) / 1024, 2).' KB )'; |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | return $info; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | namespace think\debug; |
13 | 13 | |
14 | 14 | use think\App; |
@@ -57,20 +57,20 @@ discard block |
||
57 | 57 | |
58 | 58 | // 页面Trace信息 |
59 | 59 | if ($request->host()) { |
60 | - $uri = $request->protocol() . ' ' . $request->method() . ' : ' . $request->url(true); |
|
60 | + $uri = $request->protocol().' '.$request->method().' : '.$request->url(true); |
|
61 | 61 | } else { |
62 | - $uri = 'cmd:' . implode(' ', $_SERVER['argv']); |
|
62 | + $uri = 'cmd:'.implode(' ', $_SERVER['argv']); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | $base = [ |
66 | - '请求信息' => date('Y-m-d H:i:s', $request->time()) . ' ' . $uri, |
|
67 | - '运行时间' => number_format((float) $runtime, 6) . 's [ 吞吐率:' . $reqs . 'req/s ] 内存消耗:' . $mem . 'kb 文件加载:' . count(get_included_files()), |
|
68 | - '查询信息' => $app->db->getQueryTimes() . ' queries', |
|
69 | - '缓存信息' => $app->cache->getReadTimes() . ' reads,' . $app->cache->getWriteTimes() . ' writes', |
|
66 | + '请求信息' => date('Y-m-d H:i:s', $request->time()).' '.$uri, |
|
67 | + '运行时间' => number_format((float) $runtime, 6).'s [ 吞吐率:'.$reqs.'req/s ] 内存消耗:'.$mem.'kb 文件加载:'.count(get_included_files()), |
|
68 | + '查询信息' => $app->db->getQueryTimes().' queries', |
|
69 | + '缓存信息' => $app->cache->getReadTimes().' reads,'.$app->cache->getWriteTimes().' writes', |
|
70 | 70 | ]; |
71 | 71 | |
72 | 72 | if ($app->session->getId(false)) { |
73 | - $base['会话信息'] = 'SESSION_ID=' . $app->session->getId(); |
|
73 | + $base['会话信息'] = 'SESSION_ID='.$app->session->getId(); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | $info = $this->getFileInfo(); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | // 调用Trace页面模板 |
104 | 104 | ob_start(); |
105 | - include $this->config['file'] ?: __DIR__ . '/../../tpl/page_trace.tpl'; |
|
105 | + include $this->config['file'] ?: __DIR__.'/../../tpl/page_trace.tpl'; |
|
106 | 106 | return ob_get_clean(); |
107 | 107 | } |
108 | 108 | |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $info = []; |
118 | 118 | |
119 | 119 | foreach ($files as $key => $file) { |
120 | - $info[] = $file . ' ( ' . number_format(filesize($file) / 1024, 2) . ' KB )'; |
|
120 | + $info[] = $file.' ( '.number_format(filesize($file) / 1024, 2).' KB )'; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | return $info; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\middleware; |
14 | 14 | |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | |
88 | 88 | if (isset($key) && 200 == $response->getCode() && $response->isAllowCache()) { |
89 | 89 | $header = $response->getHeader(); |
90 | - $header['Cache-Control'] = 'max-age=' . $expire . ',must-revalidate'; |
|
91 | - $header['Last-Modified'] = gmdate('D, d M Y H:i:s') . ' GMT'; |
|
92 | - $header['Expires'] = gmdate('D, d M Y H:i:s', time() + $expire) . ' GMT'; |
|
90 | + $header['Cache-Control'] = 'max-age='.$expire.',must-revalidate'; |
|
91 | + $header['Last-Modified'] = gmdate('D, d M Y H:i:s').' GMT'; |
|
92 | + $header['Expires'] = gmdate('D, d M Y H:i:s', time() + $expire).' GMT'; |
|
93 | 93 | |
94 | 94 | $this->cache->tag($tag)->set($key, [$response->getContent(), $header], $expire); |
95 | 95 | } |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | if (false !== strpos($key, ':')) { |
139 | 139 | $param = $request->param(); |
140 | 140 | foreach ($param as $item => $val) { |
141 | - if (is_string($val) && false !== strpos($key, ':' . $item)) { |
|
142 | - $key = str_replace(':' . $item, $val, $key); |
|
141 | + if (is_string($val) && false !== strpos($key, ':'.$item)) { |
|
142 | + $key = str_replace(':'.$item, $val, $key); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } elseif (strpos($key, ']')) { |
146 | - if ('[' . $request->ext() . ']' == $key) { |
|
146 | + if ('['.$request->ext().']' == $key) { |
|
147 | 147 | // 缓存某个后缀的请求 |
148 | 148 | $key = md5($request->url()); |
149 | 149 | } else { |
@@ -8,7 +8,7 @@ |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\middleware; |
14 | 14 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\middleware; |
14 | 14 | |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | // trace调试信息注入 |
79 | 79 | $pos = strripos($content, '</body>'); |
80 | 80 | if (false !== $pos) { |
81 | - $content = substr($content, 0, $pos) . $output . substr($content, $pos); |
|
81 | + $content = substr($content, 0, $pos).$output.substr($content, $pos); |
|
82 | 82 | } else { |
83 | - $content = $content . $output; |
|
83 | + $content = $content.$output; |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\middleware; |
14 | 14 | |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | if ($lang->defaultLangSet() != $langset) { |
41 | 41 | // 加载系统语言包 |
42 | 42 | $lang->load([ |
43 | - $app->getThinkPath() . 'lang' . DIRECTORY_SEPARATOR . $langset . '.php', |
|
43 | + $app->getThinkPath().'lang'.DIRECTORY_SEPARATOR.$langset.'.php', |
|
44 | 44 | ]); |
45 | 45 | |
46 | 46 | $app->LoadLangPack($langset); |
@@ -46,7 +46,7 @@ |
||
46 | 46 | |
47 | 47 | $target = $this->getTargetFile($directory, $name); |
48 | 48 | |
49 | - set_error_handler(function ($type, $msg) use (&$error) { |
|
49 | + set_error_handler(function($type, $msg) use (&$error) { |
|
50 | 50 | $error = $msg; |
51 | 51 | }); |
52 | 52 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think; |
14 | 14 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | protected function getEnv(string $name, $default = null) |
68 | 68 | { |
69 | - $result = getenv('PHP_' . $name); |
|
69 | + $result = getenv('PHP_'.$name); |
|
70 | 70 | |
71 | 71 | if (false === $result) { |
72 | 72 | return $default; |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | foreach ($env as $key => $val) { |
101 | 101 | if (is_array($val)) { |
102 | 102 | foreach ($val as $k => $v) { |
103 | - $this->data[$key . '_' . strtoupper($k)] = $v; |
|
103 | + $this->data[$key.'_'.strtoupper($k)] = $v; |
|
104 | 104 | } |
105 | 105 | } else { |
106 | 106 | $this->data[$key] = $val; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | // +---------------------------------------------------------------------- |
9 | 9 | // | Author: liu21st <[email protected]> |
10 | 10 | // +---------------------------------------------------------------------- |
11 | -declare (strict_types = 1); |
|
11 | +declare(strict_types=1); |
|
12 | 12 | |
13 | 13 | namespace think\contract; |
14 | 14 |