mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-05 22:52:49 +08:00
Route类的bind方法参数顺序调整 增加getBind方法用于获取绑定信息
This commit is contained in:
@@ -41,27 +41,27 @@ class App
|
||||
|
||||
/**
|
||||
* @var bool 应用调试模式
|
||||
*/
|
||||
*/
|
||||
public static $debug = true;
|
||||
|
||||
/**
|
||||
* @var string 应用类库命名空间
|
||||
*/
|
||||
*/
|
||||
public static $namespace = 'app';
|
||||
|
||||
/**
|
||||
* @var bool 应用类库后缀
|
||||
*/
|
||||
*/
|
||||
public static $suffix = false;
|
||||
|
||||
/**
|
||||
* @var bool 应用路由检测
|
||||
*/
|
||||
*/
|
||||
protected static $routeCheck;
|
||||
|
||||
/**
|
||||
* @var bool 严格路由检测
|
||||
*/
|
||||
*/
|
||||
protected static $routeMust;
|
||||
|
||||
/**
|
||||
@@ -108,7 +108,7 @@ class App
|
||||
break;
|
||||
case 'module':
|
||||
// 模块/控制器/操作
|
||||
$data = self::module($dispatch['module'], $config, isset($dispatch['convert']) ? $dispatch['convert'] : null );
|
||||
$data = self::module($dispatch['module'], $config, isset($dispatch['convert']) ? $dispatch['convert'] : null);
|
||||
break;
|
||||
case 'controller':
|
||||
// 执行控制器操作
|
||||
@@ -136,11 +136,11 @@ class App
|
||||
Hook::listen('app_end', $data);
|
||||
// 清空类的实例化
|
||||
Loader::clearInstance();
|
||||
|
||||
|
||||
// 输出数据到客户端
|
||||
if ($data instanceof Response) {
|
||||
return $data;
|
||||
} elseif(!is_null($data)) {
|
||||
} elseif (!is_null($data)) {
|
||||
// 默认自动识别响应输出类型
|
||||
$isAjax = $request->isAjax();
|
||||
$type = $isAjax ? Config::get('default_ajax_return') : Config::get('default_return_type');
|
||||
@@ -222,7 +222,7 @@ class App
|
||||
}
|
||||
}
|
||||
// 全局过滤
|
||||
array_walk_recursive($args, [Request::instance(),'filterExp']);
|
||||
array_walk_recursive($args, [Request::instance(), 'filterExp']);
|
||||
}
|
||||
return $args;
|
||||
}
|
||||
@@ -243,7 +243,7 @@ class App
|
||||
if ($config['app_multi_module']) {
|
||||
// 多模块部署
|
||||
$module = strip_tags(strtolower($result[0] ?: $config['default_module']));
|
||||
$bind = Route::bind('module');
|
||||
$bind = Route::getBind('module');
|
||||
$available = false;
|
||||
if ($bind) {
|
||||
// 绑定模块
|
||||
@@ -270,7 +270,7 @@ class App
|
||||
App::$modulePath = APP_PATH . ($module ? $module . DS : '');
|
||||
|
||||
// 是否自动转换控制器和操作名
|
||||
$convert = is_bool($convert) ? $convert : $config['url_convert'];
|
||||
$convert = is_bool($convert) ? $convert : $config['url_convert'];
|
||||
// 获取控制器名
|
||||
$controller = strip_tags($result[1] ?: $config['default_controller']);
|
||||
$controller = $convert ? strtolower($controller) : $controller;
|
||||
@@ -327,17 +327,17 @@ class App
|
||||
{
|
||||
if (empty(self::$init)) {
|
||||
// 初始化应用
|
||||
$config = self::init();
|
||||
self::$suffix = $config['class_suffix'];
|
||||
|
||||
$config = self::init();
|
||||
self::$suffix = $config['class_suffix'];
|
||||
|
||||
// 应用调试模式
|
||||
self::$debug = Config::get('app_debug');
|
||||
self::$debug = Config::get('app_debug');
|
||||
if (!self::$debug) {
|
||||
ini_set('display_errors', 'Off');
|
||||
}
|
||||
|
||||
|
||||
// 应用命名空间
|
||||
self::$namespace = $config['app_namespace'];
|
||||
self::$namespace = $config['app_namespace'];
|
||||
Loader::addNamespace($config['app_namespace'], APP_PATH);
|
||||
if (!empty($config['root_namespace'])) {
|
||||
Loader::addNamespace($config['root_namespace']);
|
||||
@@ -364,7 +364,6 @@ class App
|
||||
return self::$init;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 初始化应用或模块
|
||||
* @access public
|
||||
@@ -432,14 +431,14 @@ class App
|
||||
{
|
||||
// 检测URL禁用后缀
|
||||
if ($config['url_deny_suffix'] && preg_match('/\.(' . $config['url_deny_suffix'] . ')$/i', $request->pathinfo())) {
|
||||
throw new Exception('url suffix deny:'.$request->ext());
|
||||
throw new Exception('url suffix deny:' . $request->ext());
|
||||
}
|
||||
|
||||
$path = $request->path();
|
||||
$depr = $config['pathinfo_depr'];
|
||||
$result = false;
|
||||
// 路由检测
|
||||
$check = !is_null(self::$routeCheck) ? self::$routeCheck : $config['url_route_on'];
|
||||
$check = !is_null(self::$routeCheck) ? self::$routeCheck : $config['url_route_on'];
|
||||
if ($check) {
|
||||
// 开启路由
|
||||
if (!empty($config['route'])) {
|
||||
|
||||
Reference in New Issue
Block a user