//项目配置文件 return [ // 默认模块名 'default_module' => 'index', // 默认控制器名 'default_controller' => 'Index', // 默认操作名 'default_action' => 'index', //更多配置参数 //... ];
//项目配置文件
return [
'cache' => [
'type' => 'File',
'path' => CACHE_PATH,
'prefix' => '',
'expire' => 0,
],
];
Config::parse(APP_PATH.'config/config.json');
<config> <default_module>Index</default_module> <url_model>2</url_model> <session_auto_start>1</session_auto_start> </config>
{
"default_module":"Index",
"url_model":2,
"session_auto_start":True
}
$config = [
'user' => ['type'=>1,'name'=>'thinkphp'],
'db' => ['type'=>'mysql','user'=>'root','password'=>''],
];
// 设置配置参数
Config::set($config);
// 读取二级配置参数
echo Config::get('user.type');
// 或者使用助手函数
echo config('user.type');
[user] type=1 name=thinkphp [db] type=mysql user=rot password=''
<config> <user> <type>1</type> <name>thinkphp</name> </user> <db> <type>mysql</type> <user>root</user> <password></password> </db> </config>
Config::set([ 'type' => 'file', 'prefix' => 'think' ],'cache');
echo Config::get('配置参数1');
echo config('配置参数1');
dump(Config::get()); // 或者 dump(config());
Config::has('配置参数2');
echo Config::get('配置参数.二级参数');
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有