ThinkPHP5.0 framework: simple scope configuration method, thinkphp5.0 framework
This article describes how to configure the scope of thinkPHP5.0 framework. We will share this with you for your reference. The details are as follows:
Configuration parameters support the concept of scope. By default, all parameters are under the same system default scope. If your configuration parameters need to be used for different projects or isolated from each other, you can use the scope function,The scope serves the same purpose as configuring the parameter namespace..
// Import the configuration parameters in my_config.php and include the Config: load ('My _ config. php ', '', 'user'); // parse and import the configuration parameters in my_config.ini, and read the Config: parse ('My _ config. ini ', 'ini', 'test'); // set the user_type parameter and include it in the user scope Config: set ('user _ type', 1, 'user '); // configure parameters in batches and include the configuration in the test scope: Config: set ($ config, 'test'); // read the user_type Configuration Parameter echo Config :: get ('user _ type', 'user'); // read all the configuration parameters dump (Config: get ('', 'user') under the user scope ')); dump (config ('', null, 'user'); // same as above // determine whether the user_type parameter Config: has ('user _ type ', 'test ');