ThinkPHP5.0 framework: simple scope configuration method, thinkphp5.0 framework

Source: Internet
Author: User

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 ');

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.