This article mainly introduces the thinkPHP5.0 framework simple configuration of the scope of the method, a simple analysis of the function of the thinkPHP5.0 scope and configuration skills, the need for friends can refer to the following
In this paper, the method of thinkPHP5.0 framework simple configuration scope is described. Share to everyone for your reference, as follows:
Configuration parameters support the concept of scopes, 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, then you can use the scope feature, which acts like a namespace for configuration parameters .
Import the configuration parameters in the my_config.php and include the user scope config::load (' my_config.php ', ' ', ' user '),//parse and import the configuration parameters in the My_config.ini, Read into Test scope config::p arse (' my_config.ini ', ' ini ', ' test ');//Set User_type parameters and incorporate user scope Config::set (' User_type ', 1, ' User ');//Bulk Set configuration parameters and include test scope config::set ($config, ' test ');//Read User_type configuration parameter of user scope echo config::get (' User_type ', ' User ');//Read all configuration parameters under User scope dump (config::get ("', ' user ');d UMP (Config (" ', NULL, ' user ')); Ibid//Determine if there is a user_type parameter Config::has (' User_type ', ' Test ') below the test scope;