1.在thinkphp\config\下新建一個test.php配置文件
2.test.php
<?php
// 自定義配置文件
return [
'profile' => [
'name' => 'mmcike',
'bank' => [
'ABC' => '123',
'ncaa'
]
]
];
3.調用test.php配置文件
// 1.調用整個數組
$testConfig = \think\facade\Config::get('test');
輸出:
// 2.只調用鍵名 profile 下的數組
$profile = \think\facade\Config::get('test.profile');
輸出:
// 3.調用索引鍵的數組
$val = \think\facade\Config::get('test.profile.bank.0');
輸出:
以上包含了大多數數組的調用形式。