Home>Article>PHP Framework> About laravel configuration modification and reading

About laravel configuration modification and reading

藏色散人
藏色散人 forward
2021-03-01 13:51:03 2229browse

The following tutorial column fromlaravelwill introduce you to laravel configuration modification and reading. I hope it will be helpful to friends in need!

1) All configuration files of laravel are in the config directory under the root directory. You can know what a configuration file does by looking at its name. I won’t go into details here

2) Method of reading the configuration

$value = config('app.timezone');

That is to use the built-in config function to configure the file name and configure the parameter name to read the configured value

3) Set the configuration Method (only configured at runtime and will not be written to the configuration file)

config(['app.timezone' => 'Asia/Shanghai']);

PS: The omitted writing method of array is used above

4) Cache configuration

php artisan config:cache

5) Temporarily close the website

php artisan down

and then open it again

php artisan up

Recommended:The latest five Laravel video tutorials

The above is the detailed content of About laravel configuration modification and reading. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete