@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | if (!empty($bind) && preg_match('/^[a-z]/is', $bind)) { |
43 | 43 | $bind = str_replace('/', $depr, $bind); |
44 | 44 | // 如果有模块/控制器绑定 |
45 | - $url = $bind . ('.' != substr($bind, -1) ? $depr : '') . ltrim($url, $depr); |
|
45 | + $url = $bind.('.' != substr($bind, -1) ? $depr : '').ltrim($url, $depr); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | list($path, $var) = $this->rule->parseUrlPath($url); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | if ($controller && !preg_match('/^[A-Za-z0-9][\w|\.]*$/', $controller)) { |
64 | - throw new HttpException(404, 'controller not exists:' . $controller); |
|
64 | + throw new HttpException(404, 'controller not exists:'.$controller); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | // 解析操作 |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | if ($this->rule->getConfig('url_param_type')) { |
73 | 73 | $var += $path; |
74 | 74 | } else { |
75 | - preg_replace_callback('/(\w+)\|([^\|]+)/', function ($match) use (&$var) { |
|
75 | + preg_replace_callback('/(\w+)\|([^\|]+)/', function($match) use (&$var) { |
|
76 | 76 | $var[$match[1]] = strip_tags($match[2]); |
77 | 77 | }, implode('|', $path)); |
78 | 78 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $route = [$module, $controller, $action]; |
93 | 93 | |
94 | 94 | if ($this->hasDefinedRoute($route, $bind)) { |
95 | - throw new HttpException(404, 'invalid request:' . str_replace('|', $depr, $url)); |
|
95 | + throw new HttpException(404, 'invalid request:'.str_replace('|', $depr, $url)); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | return $route; |
@@ -110,12 +110,12 @@ discard block |
||
110 | 110 | list($module, $controller, $action) = $route; |
111 | 111 | |
112 | 112 | // 检查地址是否被定义过路由 |
113 | - $name = strtolower($module . '/' . Loader::parseName($controller, 1) . '/' . $action); |
|
113 | + $name = strtolower($module.'/'.Loader::parseName($controller, 1).'/'.$action); |
|
114 | 114 | |
115 | 115 | $name2 = ''; |
116 | 116 | |
117 | 117 | if (empty($module) || $module == $bind) { |
118 | - $name2 = strtolower(Loader::parseName($controller, 1) . '/' . $action); |
|
118 | + $name2 = strtolower(Loader::parseName($controller, 1).'/'.$action); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | $host = $this->request->host(true); |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | */ |
139 | 139 | protected function autoFindController($module, &$path) |
140 | 140 | { |
141 | - $dir = $this->app->getAppPath() . ($module ? $module . '/' : '') . $this->rule->getConfig('url_controller_layer'); |
|
141 | + $dir = $this->app->getAppPath().($module ? $module.'/' : '').$this->rule->getConfig('url_controller_layer'); |
|
142 | 142 | $suffix = $this->app->getSuffix() || $this->rule->getConfig('controller_suffix') ? ucfirst($this->rule->getConfig('url_controller_layer')) : ''; |
143 | 143 | |
144 | 144 | $item = []; |
@@ -146,13 +146,13 @@ discard block |
||
146 | 146 | |
147 | 147 | foreach ($path as $val) { |
148 | 148 | $item[] = $val; |
149 | - $file = $dir . '/' . str_replace('.', '/', $val) . $suffix . '.php'; |
|
150 | - $file = pathinfo($file, PATHINFO_DIRNAME) . '/' . Loader::parseName(pathinfo($file, PATHINFO_FILENAME), 1) . '.php'; |
|
149 | + $file = $dir.'/'.str_replace('.', '/', $val).$suffix.'.php'; |
|
150 | + $file = pathinfo($file, PATHINFO_DIRNAME).'/'.Loader::parseName(pathinfo($file, PATHINFO_FILENAME), 1).'.php'; |
|
151 | 151 | if (is_file($file)) { |
152 | 152 | $find = true; |
153 | 153 | break; |
154 | 154 | } else { |
155 | - $dir .= '/' . Loader::parseName($val); |
|
155 | + $dir .= '/'.Loader::parseName($val); |
|
156 | 156 | } |
157 | 157 | } |
158 | 158 |