public function start()
{
spl_autoload_register('\\Think\\PhpunitHelper::autoload');
register_shutdown_function('\\Think\\PhpunitHelper::fatalError');
Storage::connect(STORAGE_TYPE);
$mode = (include is_file(CONF_PATH . 'core.php') ? CONF_PATH . 'core.php' : MODE_PATH . APP_MODE . '.php');
// 加载核心文件
foreach ($mode['core'] as $file) {
if (is_file($file)) {
if (strpos($file, 'Think/Controller.class.php') !== false || strpos($file, 'Think\\Controller.class.php') !== false || strpos($file, 'Think/View.class.php') !== false || strpos($file, 'Think\\View.class.php') !== false) {
// not include
} else {
include_once $file;
}
}
}
// 加载应用模式配置文件
foreach ($mode['config'] as $key => $file) {
is_numeric($key) ? C(load_config($file)) : C($key, load_config($file));
}
// 读取当前应用模式对应的配置文件
if ('common' != APP_MODE && is_file(CONF_PATH . 'config_' . APP_MODE . CONF_EXT)) {
C(load_config(CONF_PATH . 'config_' . APP_MODE . CONF_EXT));
}
// 加载模式别名定义
if (isset($mode['alias'])) {
self::addMap(is_array($mode['alias']) ? $mode['alias'] : (include $mode['alias']));
}
// 加载应用别名定义文件
if (is_file(CONF_PATH . 'alias.php')) {
self::addMap(include CONF_PATH . 'alias.php');
}
// 加载模式行为定义
if (isset($mode['tags'])) {
\Think\Hook::import(is_array($mode['tags']) ? $mode['tags'] : (include $mode['tags']));
}
// 加载应用行为定义
if (is_file(CONF_PATH . 'tags.php')) {
// 允许应用增加开发模式配置定义
\Think\Hook::import(include CONF_PATH . 'tags.php');
}
// 加载框架底层语言包
L(include THINK_PATH . 'Lang/' . strtolower(C('DEFAULT_LANG')) . '.php');
// 调试模式加载系统默认的配置文件
C(include THINK_PATH . 'Conf/debug.php');
// 读取应用调试配置文件
if (is_file(CONF_PATH . 'debug' . CONF_EXT)) {
C(include CONF_PATH . 'debug' . CONF_EXT);
}
C('HTML_CACHE_ON', false);
C('LIMIT_ROBOT_VISIT', false);
C('LIMIT_PROXY_VISIT', false);
$this->run();
}