thinkphp6自定义配置文件以及调用
2022-11-24 11:10:29
202
{{single.collect_count}}

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');

输出:

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

 

回帖
全部回帖({{commentCount}})
{{item.user.nickname}} {{item.user.group_title}} {{item.friend_time}}
{{item.content}}
{{item.comment_content_show ? '取消' : '回复'}} 删除
回帖
{{reply.user.nickname}} {{reply.user.group_title}} {{reply.friend_time}}
{{reply.content}}
{{reply.comment_content_show ? '取消' : '回复'}} 删除
回帖
收起
没有更多啦~
{{commentLoading ? '加载中...' : '查看更多评论'}}