Home >PHP Framework >ThinkPHP >Thinkphp6 custom configuration file and call (configuration under the config folder)
The following tutorial column of thinkphp will introduce to you the Thinkphp6 custom configuration file and the method of calling (configuration under the config folder). I hope it will be useful to friends who need it. help!
1. Create a new test.php configuration file under thinkphp\config\
2.test.php
<?php // 自定义配置文件 return [ 'profile' => [ 'name' => 'mmcike', 'bank' => [ 'ABC' => '123', 'ncaa' ] ] ];
3. Call the test.php configuration file
// 1.调用整个数组 $testConfig = \think\facade\Config::get('test'); //注意 //test.php 就是配置文件名称
Output:
// 2.只调用键名 profile 下的数组 $profile = \think\facade\Config::get('test.profile');
输出:
// 3.调用索引键的数组 $val = \think\facade\Config::get('test.profile.bank.0');
输出:
Related recommendations: The latest 10 thinkphp video tutorials
The above is the detailed content of Thinkphp6 custom configuration file and call (configuration under the config folder). For more information, please follow other related articles on the PHP Chinese website!