1.在thinkphp\config\下新建一个test.php配置文件

tp6 自定义配置文件以及调用(config文件夹下的配置)_常量

2.test.php

<?php
// 自定义配置文件
return [
'profile' => [
'name' => 'mmcike',
'bank' => [
'ABC' => '123',
'ncaa'
]
]
];

3.调用test.php配置文件

// 1.调用整个数组
$testConfig = \think\facade\Config::get('test');

//注意
//test.php 就是配置文件名称

tp6 自定义配置文件以及调用(config文件夹下的配置)_php配置_02

输出:

tp6 自定义配置文件以及调用(config文件夹下的配置)_数组_03

// 2.只调用键名 profile 下的数组
$profile = \think\facade\Config::get('test.profile');
输出:

tp6 自定义配置文件以及调用(config文件夹下的配置)_php配置_04

// 3.调用索引键的数组
$val = \think\facade\Config::get('test.profile.bank.0');
输出:

tp6 自定义配置文件以及调用(config文件夹下的配置)_数组_05

以上包含了大多数数组的调用形式。