mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-06 23:02:48 +08:00
增加http助手函数 改进App类
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
|
||||
namespace think;
|
||||
|
||||
use think\exception\HttpException;
|
||||
|
||||
class Loader
|
||||
{
|
||||
// 类名映射
|
||||
@@ -319,7 +321,7 @@ class Loader
|
||||
} elseif ($empty && class_exists($emptyClass = self::parseClass($module, $layer, $empty, $appendSuffix))) {
|
||||
return new $emptyClass(Request::instance());
|
||||
} else {
|
||||
throw new Exception('class [ ' . $class . ' ] not exists', 10001);
|
||||
throw new HttpException(404, 'class [ ' . $class . ' ] not exists');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class Trace
|
||||
*/
|
||||
public function save(array $log = [])
|
||||
{
|
||||
if (IS_AJAX || IS_CLI || IS_API || (defined('RESPONSE_TYPE') && !in_array(RESPONSE_TYPE, ['html', 'view']))) {
|
||||
if (IS_CLI || IS_AJAX || IS_API || (defined('RESPONSE_TYPE') && !in_array(RESPONSE_TYPE, ['html', 'view']))) {
|
||||
// ajax cli api方式下不输出
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user