Code instance for thinkPHP5.0 framework simple configuration scope

Source: Internet
Author: User
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;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.