This commit is contained in:
thinkphp
2016-02-17 22:19:07 +08:00
parent e3c2f42122
commit 46d81a2575
2 changed files with 56 additions and 52 deletions

View File

@@ -6,117 +6,121 @@ return [
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// 应用模式状态 // 应用模式状态
'app_status' => '', 'app_status' => '',
// 注册的根命名空间 // 注册的根命名空间
'root_namespace' => [], 'root_namespace' => [],
// 扩展配置文件 // 扩展配置文件
'extra_config_list' => ['database', 'route'], 'extra_config_list' => ['database', 'route'],
// 扩展函数文件 // 扩展函数文件
'extra_file_list' => [THINK_PATH . 'helper' . EXT], 'extra_file_list' => [THINK_PATH . 'helper' . EXT],
// 默认输出类型 // 默认输出类型
'default_return_type' => 'html', 'default_return_type' => 'html',
// 默认语言 // 默认语言
'default_lang' => 'zh-cn', 'default_lang' => 'zh-cn',
// response是否返回方式 // response是否返回方式
'response_return' => false, 'response_return' => false,
// 默认AJAX 数据返回格式,可选JSON XML ... // 默认AJAX 数据返回格式,可选JSON XML ...
'default_ajax_return' => 'JSON', 'default_ajax_return' => 'JSON',
// 默认JSONP格式返回的处理方法 // 默认JSONP格式返回的处理方法
'default_jsonp_handler' => 'jsonpReturn', 'default_jsonp_handler' => 'jsonpReturn',
// 默认JSONP处理方法 // 默认JSONP处理方法
'var_jsonp_handler' => 'callback', 'var_jsonp_handler' => 'callback',
// 默认时区 // 默认时区
'default_timezone' => 'PRC', 'default_timezone' => 'PRC',
// 是否开启多语言 // 是否开启多语言
'lang_switch_on' => false, 'lang_switch_on' => false,
// 支持的多语言列表 // 支持的多语言列表
'lang_list' => ['zh-cn'], 'lang_list' => ['zh-cn'],
// 语言变量 // 语言变量
'lang_detect_var' => 'lang', 'lang_detect_var' => 'lang',
// 语言cookie变量 // 语言cookie变量
'lang_cookie_var' => 'think_lang', 'lang_cookie_var' => 'think_lang',
// 默认全局过滤方法 用逗号分隔多个 // 默认全局过滤方法 用逗号分隔多个
'default_filter' => '', 'default_filter' => '',
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 模块设置 // | 模块设置
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// 默认模块名 // 默认模块名
'default_module' => 'index', 'default_module' => 'index',
// 禁止访问模块 // 禁止访问模块
'deny_module_list' => [COMMON_MODULE, 'runtime'], 'deny_module_list' => [COMMON_MODULE, 'runtime'],
// 默认控制器名 // 默认控制器名
'default_controller' => 'Index', 'default_controller' => 'Index',
// 默认操作名 // 默认操作名
'default_action' => 'index', 'default_action' => 'index',
// 默认的空控制器名 // 默认的空控制器名
'empty_controller' => 'Error', 'empty_controller' => 'Error',
// 操作方法后缀 // 操作方法后缀
'action_suffix' => '', 'action_suffix' => '',
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | URL设置 // | URL设置
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// PATHINFO变量名 用于兼容模式 // PATHINFO变量名 用于兼容模式
'var_pathinfo' => 's', 'var_pathinfo' => 's',
// 兼容PATH_INFO获取 // 兼容PATH_INFO获取
'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'], 'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'],
// pathinfo分隔符 // pathinfo分隔符
'pathinfo_depr' => '/', 'pathinfo_depr' => '/',
// 获取当前页面地址的系统变量 默认为REQUEST_URI // 获取当前页面地址的系统变量 默认为REQUEST_URI
'url_request_uri' => 'REQUEST_URI', 'url_request_uri' => 'REQUEST_URI',
// 基础URL路径 // 基础URL路径
'base_url' => $_SERVER["SCRIPT_NAME"], 'base_url' => $_SERVER["SCRIPT_NAME"],
// URL伪静态后缀 // URL伪静态后缀
'url_html_suffix' => '.html', 'url_html_suffix' => '.html',
// URL普通方式参数 用于自动生成 // URL普通方式参数 用于自动生成
'url_common_param' => false, 'url_common_param' => false,
//url禁止访问的后缀 //url禁止访问的后缀
'url_deny_suffix' => 'ico|png|gif|jpg', 'url_deny_suffix' => 'ico|png|gif|jpg',
// 是否开启路由 // 是否开启路由
'url_route_on' => true, 'url_route_on' => true,
// 是否强制使用路由 // 是否强制使用路由
'url_route_must' => false, 'url_route_must' => false,
// URL模块映射 // URL模块映射
'url_module_map' => [], 'url_module_map' => [],
// 域名部署 // 域名部署
'url_domain_deploy' => false, 'url_domain_deploy' => false,
// 域名根,如.thinkphp.cn // 域名根,如.thinkphp.cn
'url_domain_root' => '', 'url_domain_root' => '',
// 是否自动转换URL中的控制器名
'url_controller_convert' => true,
// 是否自动转换URL中的操作名
'url_action_convert' => true,
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 视图及模板设置 // | 视图及模板设置
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// 默认跳转页面对应的模板文件 // 默认跳转页面对应的模板文件
'dispatch_success_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl', 'dispatch_success_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
'dispatch_error_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl', 'dispatch_error_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
// 默认的模板引擎 // 默认的模板引擎
'template_engine' => 'Think', 'template_engine' => 'Think',
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 异常及错误设置 // | 异常及错误设置
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// 异常页面的模板文件 // 异常页面的模板文件
'exception_tmpl' => THINK_PATH . 'tpl' . DS . 'think_exception.tpl', 'exception_tmpl' => THINK_PATH . 'tpl' . DS . 'think_exception.tpl',
// 异常处理忽略的错误类型支持PHP所有的错误级别常量多个级别可以用|运算法 // 异常处理忽略的错误类型支持PHP所有的错误级别常量多个级别可以用|运算法
// 参考http://php.net/manual/en/errorfunc.constants.php // 参考http://php.net/manual/en/errorfunc.constants.php
'exception_ignore_type' => 0, 'exception_ignore_type' => 0,
// 错误显示信息,非调试模式有效 // 错误显示信息,非调试模式有效
'error_message' => '页面错误!请稍后再试~', 'error_message' => '页面错误!请稍后再试~',
// 错误定向页面 // 错误定向页面
'error_page' => '', 'error_page' => '',
// 显示错误信息 // 显示错误信息
'show_error_msg' => false, 'show_error_msg' => false,
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// | 日志设置 // | 日志设置
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
'log' => [ 'log' => [
'type' => 'File', // 支持 file socket trace sae 'type' => 'File', // 支持 file socket trace sae
'path' => LOG_PATH, 'path' => LOG_PATH,
], ],
@@ -125,7 +129,7 @@ return [
// | 缓存设置 // | 缓存设置
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
'cache' => [ 'cache' => [
'type' => 'File', 'type' => 'File',
'path' => CACHE_PATH, 'path' => CACHE_PATH,
'prefix' => '', 'prefix' => '',
@@ -137,8 +141,8 @@ return [
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// 是否使用session // 是否使用session
'use_session' => true, 'use_session' => true,
'session' => [ 'session' => [
'id' => '', 'id' => '',
'var_session_id' => '', // SESSION_ID的提交变量,解决flash上传跨域 'var_session_id' => '', // SESSION_ID的提交变量,解决flash上传跨域
'prefix' => 'think', 'prefix' => 'think',
@@ -151,9 +155,9 @@ return [
// +---------------------------------------------------------------------- // +----------------------------------------------------------------------
// 是否启用多状态数据库配置 如果启用的话 需要跟随app_status配置不同的数据库信息 // 是否启用多状态数据库配置 如果启用的话 需要跟随app_status配置不同的数据库信息
'use_db_switch' => false, 'use_db_switch' => false,
'db_fields_strict' => true, 'db_fields_strict' => true,
'database' => [ 'database' => [
// 数据库类型 // 数据库类型
'type' => 'mysql', 'type' => 'mysql',
// 数据库连接DSN配置 // 数据库连接DSN配置

View File

@@ -215,11 +215,11 @@ class App
// 获取控制器名 // 获取控制器名
$controllerName = strip_tags($result[1] ?: Config::get('default_controller')); $controllerName = strip_tags($result[1] ?: Config::get('default_controller'));
define('CONTROLLER_NAME', $config['url_controller_convert'] ? strtolower($controllerName) : $controllerName); define('CONTROLLER_NAME', Config::get('url_controller_convert') ? strtolower($controllerName) : $controllerName);
// 获取操作名 // 获取操作名
$actionName = strip_tags($result[2] ?: Config::get('default_action')); $actionName = strip_tags($result[2] ?: Config::get('default_action'));
define('ACTION_NAME', $config['url_action_convert'] ? strtolower($actionName) : $actionName); define('ACTION_NAME', Config::get('url_action_convert') ? strtolower($actionName) : $actionName);
// 执行操作 // 执行操作
if (!preg_match('/^[A-Za-z](\/|\.|\w)*$/', CONTROLLER_NAME)) { if (!preg_match('/^[A-Za-z](\/|\.|\w)*$/', CONTROLLER_NAME)) {