@@ -136,10 +136,10 @@ discard block |
||
| 136 | 136 | // +---------------------------------------------------------------------- |
| 137 | 137 | |
| 138 | 138 | // 默认跳转页面对应的模板文件 |
| 139 | - 'dispatch_success_tmpl' => __DIR__ . '/tpl/dispatch_jump.tpl', |
|
| 140 | - 'dispatch_error_tmpl' => __DIR__ . '/tpl/dispatch_jump.tpl', |
|
| 139 | + 'dispatch_success_tmpl' => __DIR__.'/tpl/dispatch_jump.tpl', |
|
| 140 | + 'dispatch_error_tmpl' => __DIR__.'/tpl/dispatch_jump.tpl', |
|
| 141 | 141 | // 异常页面的模板文件 |
| 142 | - 'exception_tmpl' => __DIR__ . '/tpl/think_exception.tpl', |
|
| 142 | + 'exception_tmpl' => __DIR__.'/tpl/think_exception.tpl', |
|
| 143 | 143 | // 错误显示信息,非调试模式有效 |
| 144 | 144 | 'error_message' => '页面错误!请稍后再试~', |
| 145 | 145 | // 显示错误信息 |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | 'trace' => [ |
| 200 | 200 | // 内置Html Console 支持扩展 |
| 201 | 201 | 'type' => 'Html', |
| 202 | - 'file' => __DIR__ . '/tpl/page_trace.tpl', |
|
| 202 | + 'file' => __DIR__.'/tpl/page_trace.tpl', |
|
| 203 | 203 | ], |
| 204 | 204 | |
| 205 | 205 | // +---------------------------------------------------------------------- |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | namespace think; |
| 12 | 12 | |
| 13 | 13 | // 载入Loader类 |
| 14 | -require __DIR__ . '/library/think/Loader.php'; |
|
| 14 | +require __DIR__.'/library/think/Loader.php'; |
|
| 15 | 15 | |
| 16 | 16 | // 注册自动加载 |
| 17 | 17 | Loader::register(); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | protected function getEnv($name, $default = null, $php_prefix = true) |
| 62 | 62 | { |
| 63 | 63 | if ($php_prefix) { |
| 64 | - $name = 'PHP_' . $name; |
|
| 64 | + $name = 'PHP_'.$name; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $result = getenv($name); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | foreach ($env as $key => $val) { |
| 99 | 99 | if (is_array($val)) { |
| 100 | 100 | foreach ($val as $k => $v) { |
| 101 | - $this->data[$key . '_' . strtoupper($k)] = $v; |
|
| 101 | + $this->data[$key.'_'.strtoupper($k)] = $v; |
|
| 102 | 102 | } |
| 103 | 103 | } else { |
| 104 | 104 | $this->data[$key] = $val; |
@@ -55,21 +55,21 @@ discard block |
||
| 55 | 55 | $mem = number_format((memory_get_usage() - Container::get('app')->getBeginMem()) / 1024, 2); |
| 56 | 56 | |
| 57 | 57 | if ($request->host()) { |
| 58 | - $uri = $request->protocol() . ' ' . $request->method() . ' : ' . $request->url(true); |
|
| 58 | + $uri = $request->protocol().' '.$request->method().' : '.$request->url(true); |
|
| 59 | 59 | } else { |
| 60 | - $uri = 'cmd:' . implode(' ', $_SERVER['argv']); |
|
| 60 | + $uri = 'cmd:'.implode(' ', $_SERVER['argv']); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // 页面Trace信息 |
| 64 | 64 | $base = [ |
| 65 | - '请求信息' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . ' ' . $uri, |
|
| 66 | - '运行时间' => number_format($runtime, 6) . 's [ 吞吐率:' . $reqs . 'req/s ] 内存消耗:' . $mem . 'kb 文件加载:' . count(get_included_files()), |
|
| 67 | - '查询信息' => Db::$queryTimes . ' queries ' . Db::$executeTimes . ' writes ', |
|
| 68 | - '缓存信息' => Container::get('cache')->getReadTimes() . ' reads,' . Container::get('cache')->getWriteTimes() . ' writes', |
|
| 65 | + '请求信息' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']).' '.$uri, |
|
| 66 | + '运行时间' => number_format($runtime, 6).'s [ 吞吐率:'.$reqs.'req/s ] 内存消耗:'.$mem.'kb 文件加载:'.count(get_included_files()), |
|
| 67 | + '查询信息' => Db::$queryTimes.' queries '.Db::$executeTimes.' writes ', |
|
| 68 | + '缓存信息' => Container::get('cache')->getReadTimes().' reads,'.Container::get('cache')->getWriteTimes().' writes', |
|
| 69 | 69 | ]; |
| 70 | 70 | |
| 71 | 71 | if (session_id()) { |
| 72 | - $base['会话信息'] = 'SESSION_ID=' . session_id(); |
|
| 72 | + $base['会话信息'] = 'SESSION_ID='.session_id(); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $info = Container::get('debug')->getFile(true); |
@@ -127,9 +127,9 @@ discard block |
||
| 127 | 127 | case '调试': |
| 128 | 128 | $var_type = gettype($m); |
| 129 | 129 | if (in_array($var_type, ['array', 'string'])) { |
| 130 | - $line[] = "console.log(" . json_encode($m) . ");"; |
|
| 130 | + $line[] = "console.log(".json_encode($m).");"; |
|
| 131 | 131 | } else { |
| 132 | - $line[] = "console.log(" . json_encode(var_export($m, 1)) . ");"; |
|
| 132 | + $line[] = "console.log(".json_encode(var_export($m, 1)).");"; |
|
| 133 | 133 | } |
| 134 | 134 | break; |
| 135 | 135 | case '错误': |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $line[] = "console.log(\"%c{$msg}\", \"{$style}\");"; |
| 144 | 144 | break; |
| 145 | 145 | default: |
| 146 | - $m = is_string($key) ? $key . ' ' . $m : $key + 1 . ' ' . $m; |
|
| 146 | + $m = is_string($key) ? $key.' '.$m : $key + 1.' '.$m; |
|
| 147 | 147 | $msg = json_encode($m); |
| 148 | 148 | $line[] = "console.log({$msg});"; |
| 149 | 149 | break; |
@@ -55,19 +55,19 @@ |
||
| 55 | 55 | |
| 56 | 56 | // 页面Trace信息 |
| 57 | 57 | if ($request->host()) { |
| 58 | - $uri = $request->protocol() . ' ' . $request->method() . ' : ' . $request->url(true); |
|
| 58 | + $uri = $request->protocol().' '.$request->method().' : '.$request->url(true); |
|
| 59 | 59 | } else { |
| 60 | - $uri = 'cmd:' . implode(' ', $_SERVER['argv']); |
|
| 60 | + $uri = 'cmd:'.implode(' ', $_SERVER['argv']); |
|
| 61 | 61 | } |
| 62 | 62 | $base = [ |
| 63 | - '请求信息' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']) . ' ' . $uri, |
|
| 64 | - '运行时间' => number_format($runtime, 6) . 's [ 吞吐率:' . $reqs . 'req/s ] 内存消耗:' . $mem . 'kb 文件加载:' . count(get_included_files()), |
|
| 65 | - '查询信息' => Db::$queryTimes . ' queries ' . Db::$executeTimes . ' writes ', |
|
| 66 | - '缓存信息' => Container::get('cache')->getReadTimes() . ' reads,' . Container::get('cache')->getWriteTimes() . ' writes', |
|
| 63 | + '请求信息' => date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME']).' '.$uri, |
|
| 64 | + '运行时间' => number_format($runtime, 6).'s [ 吞吐率:'.$reqs.'req/s ] 内存消耗:'.$mem.'kb 文件加载:'.count(get_included_files()), |
|
| 65 | + '查询信息' => Db::$queryTimes.' queries '.Db::$executeTimes.' writes ', |
|
| 66 | + '缓存信息' => Container::get('cache')->getReadTimes().' reads,'.Container::get('cache')->getWriteTimes().' writes', |
|
| 67 | 67 | ]; |
| 68 | 68 | |
| 69 | 69 | if (session_id()) { |
| 70 | - $base['会话信息'] = 'SESSION_ID=' . session_id(); |
|
| 70 | + $base['会话信息'] = 'SESSION_ID='.session_id(); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $info = Container::get('debug')->getFile(true); |
@@ -76,21 +76,21 @@ discard block |
||
| 76 | 76 | if ($this->app->isDebug()) { |
| 77 | 77 | $runtime = round(microtime(true) - $this->app->getBeginTime(), 10); |
| 78 | 78 | $reqs = $runtime > 0 ? number_format(1 / $runtime, 2) : '∞'; |
| 79 | - $time_str = ' [运行时间:' . number_format($runtime, 6) . 's][吞吐率:' . $reqs . 'req/s]'; |
|
| 79 | + $time_str = ' [运行时间:'.number_format($runtime, 6).'s][吞吐率:'.$reqs.'req/s]'; |
|
| 80 | 80 | $memory_use = number_format((memory_get_usage() - $this->app->getBeginMem()) / 1024, 2); |
| 81 | - $memory_str = ' [内存消耗:' . $memory_use . 'kb]'; |
|
| 82 | - $file_load = ' [文件加载:' . count(get_included_files()) . ']'; |
|
| 81 | + $memory_str = ' [内存消耗:'.$memory_use.'kb]'; |
|
| 82 | + $file_load = ' [文件加载:'.count(get_included_files()).']'; |
|
| 83 | 83 | |
| 84 | 84 | if (isset($_SERVER['HTTP_HOST'])) { |
| 85 | - $current_uri = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; |
|
| 85 | + $current_uri = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; |
|
| 86 | 86 | } else { |
| 87 | - $current_uri = 'cmd:' . implode(' ', $_SERVER['argv']); |
|
| 87 | + $current_uri = 'cmd:'.implode(' ', $_SERVER['argv']); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | // 基本信息 |
| 91 | 91 | $trace[] = [ |
| 92 | 92 | 'type' => 'group', |
| 93 | - 'msg' => $current_uri . $time_str . $memory_str . $file_load, |
|
| 93 | + 'msg' => $current_uri.$time_str.$memory_str.$file_load, |
|
| 94 | 94 | 'css' => $this->css['page'], |
| 95 | 95 | ]; |
| 96 | 96 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | foreach ($log as $type => $val) { |
| 99 | 99 | $trace[] = [ |
| 100 | 100 | 'type' => in_array($type, $this->config['expand_level']) ? 'group' : 'groupCollapsed', |
| 101 | - 'msg' => '[ ' . $type . ' ]', |
|
| 101 | + 'msg' => '[ '.$type.' ]', |
|
| 102 | 102 | 'css' => isset($this->css[$type]) ? $this->css[$type] : '', |
| 103 | 103 | ]; |
| 104 | 104 | |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | ]; |
| 185 | 185 | |
| 186 | 186 | $msg = @json_encode($logs); |
| 187 | - $address = '/' . $client_id; //将client_id作为地址, server端通过地址判断将日志发布给谁 |
|
| 187 | + $address = '/'.$client_id; //将client_id作为地址, server端通过地址判断将日志发布给谁 |
|
| 188 | 188 | |
| 189 | 189 | $this->send($this->config['host'], $msg, $address); |
| 190 | 190 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | protected function send($host, $message = '', $address = '/') |
| 259 | 259 | { |
| 260 | - $url = 'http://' . $host . ':' . $this->port . $address; |
|
| 260 | + $url = 'http://'.$host.':'.$this->port.$address; |
|
| 261 | 261 | $ch = curl_init(); |
| 262 | 262 | |
| 263 | 263 | curl_setopt($ch, CURLOPT_URL, $url); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | if (empty($this->config['path'])) { |
| 43 | - $this->config['path'] = $this->app->getRuntimePath() . 'log' . DIRECTORY_SEPARATOR; |
|
| 43 | + $this->config['path'] = $this->app->getRuntimePath().'log'.DIRECTORY_SEPARATOR; |
|
| 44 | 44 | } elseif (substr($this->config['path'], -1) != DIRECTORY_SEPARATOR) { |
| 45 | 45 | $this->config['path'] .= DIRECTORY_SEPARATOR; |
| 46 | 46 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $msg = var_export($msg, true); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $info[$type][] = $this->config['json'] ? $msg : '[ ' . $type . ' ] ' . $msg; |
|
| 72 | + $info[$type][] = $this->config['json'] ? $msg : '[ '.$type.' ] '.$msg; |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | if (!$this->config['json'] && (true === $this->config['apart_level'] || in_array($type, $this->config['apart_level']))) { |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | protected function getMasterLogFile() |
| 137 | 137 | { |
| 138 | 138 | if ($this->config['max_files']) { |
| 139 | - $files = glob($this->config['path'] . '*.log'); |
|
| 139 | + $files = glob($this->config['path'].'*.log'); |
|
| 140 | 140 | |
| 141 | 141 | try { |
| 142 | 142 | if (count($files) > $this->config['max_files']) { |
@@ -151,15 +151,15 @@ discard block |
||
| 151 | 151 | if ($this->config['single']) { |
| 152 | 152 | $name = is_string($this->config['single']) ? $this->config['single'] : 'single'; |
| 153 | 153 | |
| 154 | - $destination = $this->config['path'] . $name . $cli . '.log'; |
|
| 154 | + $destination = $this->config['path'].$name.$cli.'.log'; |
|
| 155 | 155 | } else { |
| 156 | 156 | if ($this->config['max_files']) { |
| 157 | - $filename = date('Ymd') . $cli . '.log'; |
|
| 157 | + $filename = date('Ymd').$cli.'.log'; |
|
| 158 | 158 | } else { |
| 159 | - $filename = date('Ym') . DIRECTORY_SEPARATOR . date('d') . $cli . '.log'; |
|
| 159 | + $filename = date('Ym').DIRECTORY_SEPARATOR.date('d').$cli.'.log'; |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - $destination = $this->config['path'] . $filename; |
|
| 162 | + $destination = $this->config['path'].$filename; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | return $destination; |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $name = date('d'); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - return $path . DIRECTORY_SEPARATOR . $name . '_' . $type . $cli . '.log'; |
|
| 187 | + return $path.DIRECTORY_SEPARATOR.$name.'_'.$type.$cli.'.log'; |
|
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | /** |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | { |
| 198 | 198 | if (is_file($destination) && floor($this->config['file_size']) <= filesize($destination)) { |
| 199 | 199 | try { |
| 200 | - rename($destination, dirname($destination) . DIRECTORY_SEPARATOR . time() . '-' . basename($destination)); |
|
| 200 | + rename($destination, dirname($destination).DIRECTORY_SEPARATOR.time().'-'.basename($destination)); |
|
| 201 | 201 | } catch (\Exception $e) { |
| 202 | 202 | } |
| 203 | 203 | } |
@@ -212,14 +212,14 @@ discard block |
||
| 212 | 212 | protected function parseCliLog($info) |
| 213 | 213 | { |
| 214 | 214 | if ($this->config['json']) { |
| 215 | - $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\r\n"; |
|
| 215 | + $message = json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)."\r\n"; |
|
| 216 | 216 | } else { |
| 217 | 217 | $now = $info['timestamp']; |
| 218 | 218 | unset($info['timestamp']); |
| 219 | 219 | |
| 220 | 220 | $message = implode("\r\n", $info); |
| 221 | 221 | |
| 222 | - $message = "[{$now}]" . $message . "\r\n"; |
|
| 222 | + $message = "[{$now}]".$message."\r\n"; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | return $message; |
@@ -242,13 +242,13 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | if ($this->config['json']) { |
| 244 | 244 | $info = $requestInfo + $info; |
| 245 | - return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES) . "\r\n"; |
|
| 245 | + return json_encode($info, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)."\r\n"; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | array_unshift($info, "---------------------------------------------------------------\r\n[{$info['timestamp']}] {$requestInfo['ip']} {$requestInfo['method']} {$requestInfo['host']}{$requestInfo['uri']}"); |
| 249 | 249 | unset($info['timestamp']); |
| 250 | 250 | |
| 251 | - return implode("\r\n", $info) . "\r\n"; |
|
| 251 | + return implode("\r\n", $info)."\r\n"; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | protected function getDebugLog(&$info, $append, $apart) |
@@ -263,9 +263,9 @@ discard block |
||
| 263 | 263 | $memory_use = number_format((memory_get_usage() - $this->app->getBeginMem()) / 1024, 2); |
| 264 | 264 | |
| 265 | 265 | $info = [ |
| 266 | - 'runtime' => number_format($runtime, 6) . 's', |
|
| 267 | - 'reqs' => $reqs . 'req/s', |
|
| 268 | - 'memory' => $memory_use . 'kb', |
|
| 266 | + 'runtime' => number_format($runtime, 6).'s', |
|
| 267 | + 'reqs' => $reqs.'req/s', |
|
| 268 | + 'memory' => $memory_use.'kb', |
|
| 269 | 269 | 'file' => count(get_included_files()), |
| 270 | 270 | ] + $info; |
| 271 | 271 | |
@@ -276,11 +276,11 @@ discard block |
||
| 276 | 276 | |
| 277 | 277 | $memory_use = number_format((memory_get_usage() - $this->app->getBeginMem()) / 1024, 2); |
| 278 | 278 | |
| 279 | - $time_str = '[运行时间:' . number_format($runtime, 6) . 's] [吞吐率:' . $reqs . 'req/s]'; |
|
| 280 | - $memory_str = ' [内存消耗:' . $memory_use . 'kb]'; |
|
| 281 | - $file_load = ' [文件加载:' . count(get_included_files()) . ']'; |
|
| 279 | + $time_str = '[运行时间:'.number_format($runtime, 6).'s] [吞吐率:'.$reqs.'req/s]'; |
|
| 280 | + $memory_str = ' [内存消耗:'.$memory_use.'kb]'; |
|
| 281 | + $file_load = ' [文件加载:'.count(get_included_files()).']'; |
|
| 282 | 282 | |
| 283 | - array_unshift($info, $time_str . $memory_str . $file_load); |
|
| 283 | + array_unshift($info, $time_str.$memory_str.$file_load); |
|
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | if ($this->parent && $this->parent->getFullName()) { |
| 95 | - $this->fullName = $this->parent->getFullName() . ($this->name ? '/' . $this->name : ''); |
|
| 95 | + $this->fullName = $this->parent->getFullName().($this->name ? '/'.$this->name : ''); |
|
| 96 | 96 | } else { |
| 97 | 97 | $this->fullName = $this->name; |
| 98 | 98 | } |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | if ($this->auto) { |
| 184 | 184 | // 自动解析URL地址 |
| 185 | - $result = new UrlDispatch($request, $this, $this->auto . '/' . $url, ['auto_search' => false]); |
|
| 185 | + $result = new UrlDispatch($request, $this, $this->auto.'/'.$url, ['auto_search' => false]); |
|
| 186 | 186 | } elseif ($this->miss && in_array($this->miss->getMethod(), ['*', $method])) { |
| 187 | 187 | // 未匹配所有路由的路由规则处理 |
| 188 | 188 | $result = $this->miss->parseRule($request, '', $this->miss->getRoute(), $url, $this->miss->mergeGroupOptions()); |
@@ -279,11 +279,11 @@ discard block |
||
| 279 | 279 | protected function checkMergeRuleRegex($request, &$rules, $url, $completeMatch) |
| 280 | 280 | { |
| 281 | 281 | $depr = $this->router->config('pathinfo_depr'); |
| 282 | - $url = $depr . str_replace('|', $depr, $url); |
|
| 282 | + $url = $depr.str_replace('|', $depr, $url); |
|
| 283 | 283 | |
| 284 | 284 | foreach ($rules as $key => $item) { |
| 285 | 285 | if ($item instanceof RuleItem) { |
| 286 | - $rule = $depr . str_replace('/', $depr, $item->getRule()); |
|
| 286 | + $rule = $depr.str_replace('/', $depr, $item->getRule()); |
|
| 287 | 287 | if ($depr == $rule && $depr != $url) { |
| 288 | 288 | unset($rules[$key]); |
| 289 | 289 | continue; |
@@ -300,21 +300,21 @@ discard block |
||
| 300 | 300 | continue; |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - $slash = preg_quote('/-' . $depr, '/'); |
|
| 303 | + $slash = preg_quote('/-'.$depr, '/'); |
|
| 304 | 304 | |
| 305 | - if ($matchRule = preg_split('/[' . $slash . ']<\w+\??>/', $rule, 2)) { |
|
| 305 | + if ($matchRule = preg_split('/['.$slash.']<\w+\??>/', $rule, 2)) { |
|
| 306 | 306 | if ($matchRule[0] && 0 !== strncasecmp($rule, $url, strlen($matchRule[0]))) { |
| 307 | 307 | unset($rules[$key]); |
| 308 | 308 | continue; |
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - if (preg_match_all('/[' . $slash . ']?<?\w+\??>?/', $rule, $matches)) { |
|
| 312 | + if (preg_match_all('/['.$slash.']?<?\w+\??>?/', $rule, $matches)) { |
|
| 313 | 313 | unset($rules[$key]); |
| 314 | 314 | $pattern = array_merge($this->getPattern(), $item->getPattern()); |
| 315 | 315 | $option = array_merge($this->getOption(), $item->getOption()); |
| 316 | 316 | |
| 317 | - $regex[$key] = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $complete, '_THINK_' . $key); |
|
| 317 | + $regex[$key] = $this->buildRuleRegex($rule, $matches[0], $pattern, $option, $complete, '_THINK_'.$key); |
|
| 318 | 318 | $items[$key] = $item; |
| 319 | 319 | } |
| 320 | 320 | } |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | try { |
| 328 | - $result = preg_match('/^(?:' . implode('|', $regex) . ')/u', $url, $match); |
|
| 328 | + $result = preg_match('/^(?:'.implode('|', $regex).')/u', $url, $match); |
|
| 329 | 329 | } catch (\Exception $e) { |
| 330 | 330 | throw new Exception('route pattern error'); |
| 331 | 331 | } |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | if (!isset($pos)) { |
| 344 | 344 | foreach ($regex as $key => $item) { |
| 345 | - if (0 === strpos(str_replace(['\/', '\-', '\\' . $depr], ['/', '-', $depr], $item), $match[0])) { |
|
| 345 | + if (0 === strpos(str_replace(['\/', '\-', '\\'.$depr], ['/', '-', $depr], $item), $match[0])) { |
|
| 346 | 346 | $pos = $key; |
| 347 | 347 | break; |
| 348 | 348 | } |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | public function prefix($prefix) |
| 506 | 506 | { |
| 507 | 507 | if ($this->parent && $this->parent->getOption('prefix')) { |
| 508 | - $prefix = $this->parent->getOption('prefix') . $prefix; |
|
| 508 | + $prefix = $this->parent->getOption('prefix').$prefix; |
|
| 509 | 509 | } |
| 510 | 510 | |
| 511 | 511 | return $this->option('prefix', $prefix); |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | $item = []; |
| 80 | 80 | |
| 81 | 81 | foreach ($array as $val) { |
| 82 | - $item[] = $val . '/<' . (isset($option['var'][$val]) ? $option['var'][$val] : $val . '_id') . '>'; |
|
| 82 | + $item[] = $val.'/<'.(isset($option['var'][$val]) ? $option['var'][$val] : $val.'_id').'>'; |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - $rule = implode('/', $item) . '/' . $last; |
|
| 85 | + $rule = implode('/', $item).'/'.$last; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $prefix = substr($rule, strlen($this->name) + 1); |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | if (isset($last) && strpos($val[1], '<id>') && isset($option['var'][$last])) { |
| 98 | - $val[1] = str_replace('<id>', '<' . $option['var'][$last] . '>', $val[1]); |
|
| 98 | + $val[1] = str_replace('<id>', '<'.$option['var'][$last].'>', $val[1]); |
|
| 99 | 99 | } elseif (strpos($val[1], '<id>') && isset($option['var'][$rule])) { |
| 100 | - $val[1] = str_replace('<id>', '<' . $option['var'][$rule] . '>', $val[1]); |
|
| 100 | + $val[1] = str_replace('<id>', '<'.$option['var'][$rule].'>', $val[1]); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - $this->addRule(trim($prefix . $val[1], '/'), $this->route . '/' . $val[2], $val[0]); |
|
| 103 | + $this->addRule(trim($prefix.$val[1], '/'), $this->route.'/'.$val[2], $val[0]); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | $this->router->setGroup($origin); |