mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
增加入口文件自动绑定模块的功能
This commit is contained in:
@@ -15,6 +15,8 @@ return [
|
|||||||
'app_status' => '',
|
'app_status' => '',
|
||||||
// 是否支持多模块
|
// 是否支持多模块
|
||||||
'app_multi_module' => true,
|
'app_multi_module' => true,
|
||||||
|
// 入口自动绑定模块
|
||||||
|
'auto_bind_module' => false,
|
||||||
// 注册的根命名空间
|
// 注册的根命名空间
|
||||||
'root_namespace' => [],
|
'root_namespace' => [],
|
||||||
// 扩展配置文件
|
// 扩展配置文件
|
||||||
|
|||||||
@@ -79,6 +79,17 @@ class App
|
|||||||
is_null($request) && $request = Request::instance();
|
is_null($request) && $request = Request::instance();
|
||||||
|
|
||||||
$config = self::initCommon();
|
$config = self::initCommon();
|
||||||
|
if (defined('BIND_MODULE')) {
|
||||||
|
// 模块/控制器绑定
|
||||||
|
Route::bind(BIND_MODULE);
|
||||||
|
} elseif ($config['auto_bind_module']) {
|
||||||
|
// 入口自动绑定
|
||||||
|
$name = pathinfo($request->baseFile(), PATHINFO_FILENAME);
|
||||||
|
if ($name && 'index' != $name && is_dir(APP_PATH . $name)) {
|
||||||
|
Route::bind($name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$request->filter($config['default_filter']);
|
$request->filter($config['default_filter']);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
@@ -374,7 +385,7 @@ class App
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 应用命名空间
|
// 注册应用命名空间
|
||||||
self::$namespace = $config['app_namespace'];
|
self::$namespace = $config['app_namespace'];
|
||||||
Loader::addNamespace($config['app_namespace'], APP_PATH);
|
Loader::addNamespace($config['app_namespace'], APP_PATH);
|
||||||
if (!empty($config['root_namespace'])) {
|
if (!empty($config['root_namespace'])) {
|
||||||
|
|||||||
Reference in New Issue
Block a user