ThinkPHP笔记4——使用助手函数配置获取与设置

<?php
namespace app\admin\controller;

class User
{

public function helper()

{
//助手函数不依赖于Config类,即不需要:use think\facade\Config;


//1.不传入参数就是获取全部的配置项
//dump(config());


//2.查询app里的配置项
//dump(config('default_module'));


//3.查询database一级配置项下的内容
//dump(config('database.username'));


//4.查询database一级配置项是否含有某二级配置项
dump(config('?database.username'));


//5.设置配置项内容
config('app_debug',true);

}

}

猜你喜欢

转载自blog.csdn.net/weixin_40096730/article/details/80570145
今日推荐