增加http助手函数 改进App类

This commit is contained in:
thinkphp
2016-05-29 23:07:24 +08:00
parent eadaef6425
commit d122bad9b6
5 changed files with 18 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ namespace think;
use think\Config;
use think\Exception;
use think\exception\HttpException;
use think\exception\HttpResponseException;
use think\Hook;
use think\Lang;
@@ -249,7 +250,7 @@ class App
// 初始化模块
$config = self::initModule(MODULE_NAME, $config);
} else {
throw new Exception('module [ ' . MODULE_NAME . ' ] not exists ', 10005);
throw new HttpException(404'module [ ' . MODULE_NAME . ' ] not exists ');
}
} else {
// 单一模块部署
@@ -383,7 +384,7 @@ class App
$result = Route::check($request, $path, $depr, !IS_CLI ? $config['url_domain_deploy'] : false);
if (APP_ROUTE_MUST && false === $result && $config['url_route_must']) {
// 路由无效
throw new Exception('route not define ');
throw new HttpException(404, 'Not Found');
}
}
if (false === $result) {