Home > PHP Framework > Laravel > body text

About laravel configuration modification and reading

藏色散人
Release: 2021-03-01 13:51:15
forward
2310 people have browsed it

The following tutorial column from laravel will 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');
Copy after login

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']);
Copy after login

PS: The omitted writing method of array is used above

4) Cache configuration

php artisan config:cache
Copy after login

5) Temporarily close the website

php artisan down
Copy after login

and then open it again

php artisan up
Copy after login

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!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template