public function index()
{
//Set a set of configuration items
$config = [
'user_name' => 'vivian',
'user_age' => 22,
];
//Batch settings, write to user scope
Config: :set($config,'user');
// Output all configuration items, the scope is equivalent to the name of the secondary configuration item
// dump(Config::get() );
//Use an array to configure the values in the scope
Config::set('user.user_name','php_cn');
/ /View the set value
dump(Config::get('user.user_name'));
// Switch scope
Config::range(' _sys_');
//View all configuration items
dump(Config::get());
}
Batch setting method here Config:set($config,'user'); is wrong. This actually writes $config into the system scope. The correct way of writing it should be Config::set($config,'','user') ;
In addition, the configuration parameters set in the user scope should not be visible in the system configuration
I’ll go, it’s awesome!