取消APP_NAMESPACE常量定义 改为 App::$namespace 调整Build类的module和run方法 增加namespace参数

This commit is contained in:
thinkphp
2016-06-15 22:42:49 +08:00
parent fe8f51dd68
commit 2aa3e4fa5b
9 changed files with 33 additions and 22 deletions

View File

@@ -44,6 +44,11 @@ class App
*/
public static $debug = true;
/**
* @var string 应用类库命名空间
*/
public static $namespace = 'app';
/**
* 执行应用程序
* @access public
@@ -300,15 +305,17 @@ class App
{
if (empty(self::$init)) {
// 初始化应用
self::$init = $config = self::init();
$config = self::init();
// 是否调试模式
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'];
Loader::addNamespace($config['app_namespace'], APP_PATH);
if (!empty($config['root_namespace'])) {
Loader::addNamespace($config['root_namespace']);
}
@@ -328,6 +335,8 @@ class App
// 监听app_init
Hook::listen('app_init');
self::$init = $config;
}
return self::$init;
}