Laravel4.2 get the configuration file value

Source: Internet
Author: User
Config: Get ('app. timezone ');

Laravel uses the config: Get method to obtain the value of the configuration file.

The location of laravel configuration files is in the PHP file in the app. config folder. The PHP File Stores arrays, so we use. (DOT) to access values in arrays of different files.

If no default value is available

$ Timezone = config: Get ('app. timezone ', 'utc'); echo $ timezone;


In this way, you can specify a default value.

 

Config: Set ('database. default', 'sqlite ');


The modified value is limited to this request and does not change the configuration value permanently.

 

According to the explanation in the official documentation, create your own configuration folder in the config folder, and specify different values in the PHP file under the folder, so that you can overwrite the default values with your own values, the specific configuration file can be used through Bootstrap/start. PHP to specify, open this folder to see such code

 

$ ENV = $ app-> detectenvironment (Array ('local' => array ('your-machine-name '),));

 

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.