配置參考
慣例配置
應用設置
// 應用命名空(kong)間
'app_namespace' => 'app',
// 應用調試(shi)模(mo)式(shi)
'app_debug' => true,
// 應用模式狀態(tai)
'app_status' => '',
// 應(ying)用(yong)Trace
'app_trace' => false,
// 是否(fou)支持多模塊
'app_multi_module' => true,
// 注冊的根命名空(kong)間
'root_namespace' => [],
// 擴展配(pei)置文件 (V5.0.1 已(yi)經廢棄)
'extra_config_list' => ['database', 'route', 'validate'],
// 擴展函數文(wen)件
'extra_file_list' => [THINK_PATH . 'helper' . EXT],
// 默認輸出類(lei)型
'default_return_type' => 'html',
// 默(mo)認AJAX 數據返(fan)回格式(shi),可選json xml ...
'default_ajax_return' => 'json',
// 默(mo)認(ren)JSONP格式返回的處(chu)理方法
'default_jsonp_handler' => 'jsonpReturn',
// 默認(ren)JSONP處(chu)理方法
'var_jsonp_handler' => 'callback',
// 默認(ren)時區
'default_timezone' => 'PRC',
// 是否(fou)開啟多語言
'lang_switch_on' => false,
// 默認(ren)全局過濾方法 用逗(dou)號分(fen)隔多個
'default_filter' => '',
// 默認語(yu)言
'default_lang' => 'zh-cn',
// 應(ying)用(yong)類庫后綴
'class_suffix' => false,
// 控制器(qi)類后綴
'controller_suffix' => false,
模塊設置
// 默認模塊名
'default_module' => 'index',
// 禁止訪(fang)問(wen)模塊
'deny_module_list' => ['common'],
// 默(mo)認控制(zhi)器(qi)名(ming)
'default_controller' => 'Index',
// 默認(ren)操作(zuo)名
'default_action' => 'index',
// 默認驗證(zheng)器(qi)
'default_validate' => '',
// 默認的(de)空(kong)控制器(qi)名
'empty_controller' => 'Error',
// 操作方(fang)法(fa)后綴
'action_suffix' => '',
// 自動搜索控制器
'controller_auto_search' => false,
URL設置
// PATHINFO變量名 用(yong)于兼(jian)容模式
'var_pathinfo' => 's',
// 兼容PATH_INFO獲取
'pathinfo_fetch' => ['ORIG_PATH_INFO', 'REDIRECT_PATH_INFO', 'REDIRECT_URL'],
// pathinfo分隔符
'pathinfo_depr' => '/',
// URL偽靜態后綴
'url_html_suffix' => 'html',
// URL普通方式參數 用于(yu)自動生成
'url_common_param' => false,
// URL參數方式 0 按名稱(cheng)成對解析(xi) 1 按順序解析(xi)
'url_param_type' => 0,
// 是否開啟路由(you)
'url_route_on' => true,
// 是否強制使用路由
'url_route_must' => false,
// 域名(ming)部署
'url_domain_deploy' => false,
// 域名根,如(ru)thinkphp.cn
'url_domain_root' => '',
// 是否自動轉換URL中的控制器和操作名
'url_convert' => true,
// 默認(ren)的訪問控制器層(ceng)
'url_controller_layer' => 'controller',
// 表單請求類型偽裝變量
'var_method' => '_method',
// 表單ajax偽裝變量 V5.0.2+
'var_ajax' => '_ajax',
// 表單pjax偽裝變量 V5.0.2+
'var_pjax' => '_pjax',
// 是否(fou)開啟請(qing)求緩(huan)存 true自(zi)動緩(huan)存 支(zhi)持設置請(qing)求緩(huan)存規則 V5.0.3+
'request_cache' => false,
// 請求緩(huan)存(cun)有效期 V5.0.3+
'request_cache_expire' => null,
模板引擎設置
'template' => [
// 模板引擎類型(xing) 支持(chi) php think 支持(chi)擴展
'type' => 'Think',
// 模板路徑(jing)
'view_path' => '',
// 模(mo)板后(hou)綴
'view_suffix' => 'html',
// 模板文件名(ming)分隔符
'view_depr' => DS,
// 模板引擎(qing)普(pu)通標簽(qian)開始標記
'tpl_begin' => '{',
// 模板引擎普(pu)通標簽結束標記
'tpl_end' => '}',
// 標(biao)簽庫標(biao)簽開始(shi)標(biao)記
'taglib_begin' => '{',
// 標簽庫(ku)標簽結束(shu)標記
'taglib_end' => '}',
],
// 視圖輸出字符串內容替換
'view_replace_str' => [],
// 默認跳轉頁面對應的模板文件(jian)
'dispatch_success_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
'dispatch_error_tmpl' => THINK_PATH . 'tpl' . DS . 'dispatch_jump.tpl',
異常及錯誤設置
// 異常頁面(mian)的(de)模板文件
'exception_tmpl' => THINK_PATH . 'tpl' . DS . 'think_exception.tpl',
// 錯誤顯示信(xin)息,非調試模式有效
'error_message' => '頁(ye)面錯誤!請稍后(hou)再試~',
// 顯示錯誤信息
'show_error_msg' => false,
日志設置
'log' => [
// 日志記錄方式,支持(chi) file socket
'type' => 'File',
// 日志保存(cun)目錄
'path' => LOG_PATH,
],
Trace設置
'trace' => [
// 內置Html Console 支持擴展
'type' => 'Html',
],
緩存設置
'cache' => [
// 驅動方式
'type' => 'File',
// 緩(huan)存保(bao)存目錄
'path' => CACHE_PATH,
// 緩存(cun)前綴(zhui)
'prefix' => '',
// 緩(huan)存有效期 0表示永久緩(huan)存
'expire' => 0,
],
會話設置
'session' => [
'id' => '',
// SESSION_ID的提交變量,解決flash上傳跨域(yu)
'var_session_id' => '',
// SESSION 前綴
'prefix' => 'think',
// 驅動方式 支(zhi)持redis memcache memcached
'type' => '',
// 是(shi)否自動開(kai)啟(qi) SESSION
'auto_start' => true,
],
Cookie設置
'cookie' => [
// cookie 名稱前綴
'prefix' => '',
// cookie 保存時間
'expire' => 0,
// cookie 保存(cun)路(lu)徑(jing)
'path' => '/',
// cookie 有(you)效(xiao)域名
'domain' => '',
// cookie 啟(qi)用安(an)全(quan)傳輸(shu)
'secure' => false,
// httponly設置
'httponly' => '',
// 是否使用 setcookie
'setcookie' => true,
],
數據庫設置
'database' => [
// 數據庫類型
'type' => 'mysql',
// 數據(ju)庫(ku)連(lian)接(jie)DSN配置
'dsn' => '',
// 服(fu)務器地址
'hostname' => 'localhost',
// 數據庫名(ming)
'database' => '',
// 數據庫用戶名
'username' => 'root',
// 數據庫密碼
'password' => '',
// 數據庫連接端口
'hostport' => '',
// 數據庫連接參數
'params' => [],
// 數據庫編碼默(mo)認采用(yong)utf8
'charset' => 'utf8',
// 數(shu)據庫表(biao)前綴
'prefix' => '',
// 數(shu)據庫調試(shi)模式
'debug' => false,
// 數據庫部署(shu)方式:0 集中(zhong)式(單一服務(wu)器),1 分布式(主(zhu)從服務(wu)器)
'deploy' => 0,
// 數(shu)據庫讀寫是否(fou)分離(li) 主從(cong)式有效
'rw_separate' => false,
// 讀寫分離后 主服(fu)務器數量(liang)
'master_num' => 1,
// 指定(ding)從服務器序號
'slave_no' => '',
// 是否(fou)嚴(yan)格檢查字(zi)段是否(fou)存(cun)在
'fields_strict' => true,
// 數據集返(fan)回(hui)類型
'resultset_type' => 'array',
// 自動寫入(ru)時(shi)間戳字(zi)段
'auto_timestamp' => false,
// 是否需(xu)要進行SQL性能分析
'sql_explain' => false,
],
分頁配置
'paginate' => [
'type' => 'bootstrap',
'var_page' => 'page',
'list_rows' => 15,
],
文檔最后更新時間:2018-04-26 11:07:52
常量參考 →
未解決你的問題?請到「問答社區」反饋你遇到的問題
