下面給大家介紹Thinkphp6自定義配置文件以及調用(config文件夾下的配置)方法,希望對需要的朋友有所幫助!

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');
//注意
//test.php 就是配置文件名稱
輸出:

// 2.只調用鍵名 profile 下的數組
$profile = \think\facade\Config::get('test.profile');輸出:

// 3.調用索引鍵的數組
$val = \think\facade\Config::get('test.profile.bank.0');輸出:
ncaa






