批改状态:未批改
老师批语:
一、配置
读取配置项
//读取某一个参数 get 取得是二级配置 默认是app.php 所以不加前面就是app下面的配置项 $res = Config::get('database.hostname');
点击 "运行实例" 按钮查看在线实例
读取一级配置下的所有配置
//读取一级配置下的所有配置 $res = Config::pull('database'); $res = Config::get('database.');
点击 "运行实例" 按钮查看在线实例
判断是否存在该配置用has
//判断是否存在配置项 默认app.php $res = Config::has('default_return_type'); //true $res = Config::has('database.default_return_type'); //false $res = Config::has('database.username'); //true
点击 "运行实例" 按钮查看在线实例
还可以动态设置 用set
//设置 不推荐 因为容器模式批改状态:未批改
老师批语:
Copyright 2014-2024 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号