diff --git a/library/think/Request.php b/library/think/Request.php index 74202d99..1842eb93 100644 --- a/library/think/Request.php +++ b/library/think/Request.php @@ -37,9 +37,9 @@ class Request protected static $path; /** - * @var string 路由 + * @var array 路由 */ - protected static $route; + protected static $route = []; /** * @var array 调度信息 @@ -435,10 +435,10 @@ class Request /** * 获取当前请求的路由 * @access public - * @param string $route 路由名称 - * @return string + * @param array $route 路由名称 + * @return array */ - public static function route($route = '') + public static function route($route = []) { if (!empty($route)) { self::$route = $route; diff --git a/library/think/Response.php b/library/think/Response.php index cf3f285c..0eca0c68 100644 --- a/library/think/Response.php +++ b/library/think/Response.php @@ -12,6 +12,7 @@ namespace think; use think\Config; +use think\Url; use think\View; class Response @@ -178,7 +179,8 @@ class Response $type = IS_AJAX ? Config::get('default_ajax_return') : Config::get('default_return_type'); if ('html' == $type) { - $result = View::instance()->fetch(Config::get('dispatch_success_tmpl'), $result); + $result = View::instance(Config::get('template'), Config::get('view_replace_str')) + ->fetch(Config::get('dispatch_success_tmpl'), $result); } self::type($type); return $result; @@ -211,7 +213,8 @@ class Response $type = IS_AJAX ? Config::get('default_ajax_return') : Config::get('default_return_type'); if ('html' == $type) { - $result = View::instance()->fetch(Config::get('dispatch_error_tmpl'), $result); + $result = View::instance(Config::get('template'), Config::get('view_replace_str')) + ->fetch(Config::get('dispatch_error_tmpl'), $result); } self::type($type); return $result; diff --git a/library/think/Route.php b/library/think/Route.php index 00880b11..2178b1e9 100644 --- a/library/think/Route.php +++ b/library/think/Route.php @@ -418,7 +418,7 @@ class Route } $result = self::checkRule($key, $route, $url1, $pattern, $option); if (false !== $result) { - Request::route($route); + Request::route(['rule' => $key, 'route' => $route, 'pattern' => $pattern, 'option' => $option]); return $result; } } @@ -431,7 +431,7 @@ class Route // 规则路由 $result = self::checkRule($rule, $route, $url, $pattern, $option); if (false !== $result) { - Request::route($route); + Request::route(['rule' => $rule, 'route' => $route, 'pattern' => $pattern, 'option' => $option]); return $result; } }