Scope setting issue
宝怡
宝怡 2019-08-15 17:55:06
0
1
1317

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

宝怡
宝怡

reply all (1)
像风一样自由

I’ll go, it’s awesome!

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!