如何停止Laravel 5的缓存配置? [英] How to stop Laravel 5 from caching configurations?
问题描述
Laravel 5文档中写道,php artisan config:cache
将所有应用程序配置存储到一个文件中,从而使应用程序加载速度更快.
It is written in Laravel 5 documentation that php artisan config:cache
stores all the app configuration into one single file which makes the application load faster.
我想知道两件事:
第一件事是,如何强制Laravel停止缓存我的应用程序配置?例如,我希望Laravel从.env
文件或database.php
配置文件而不是从缓存的数据中读取数据库的名称和密码.
The first thing is, how to force Laravel to stop caching my app configurations? For example, I want Laravel to read the name of my database and the password from the .env
file or from the database.php
configuration file, not from the cached data.
第二件事是,Laravel在哪里存储此缓存的配置文件,以便在需要时可以将其删除?我知道有一个Artisan命令,它是php artisan config:clear
,但是我想知道文件的存储位置.
The second thing is, where does Laravel store this cached configuration file, so that I can delete it when needed? I know there is an Artisan command for that, which is php artisan config:clear
, but I want to know where the file stored.
推荐答案
您不能停止缓存配置文件,因为它不会自动发生.您唯一要做的就是不要调用config:cache
.
You can't stop the caching of config files since it doesn't happen automatically. The only thing you need to do, is not call config:cache
.
文件本身可以在bootstrap/cache/config.php
中找到.
The file itself can be found in bootstrap/cache/config.php
.
注意,已编译的配置文件的位置最近已更改.您可能也位于vendor/config.php
或storage/framework/config.php
中.全新安装或运行composer update
时,文件应位于bootstrap/cache
中.
Note that the location of the compiled config file has changed recently. Yours might also be in vendor/config.php
or storage/framework/config.php
. With a fresh install or if you run composer update
the file should be in bootstrap/cache
though.
这篇关于如何停止Laravel 5的缓存配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!