如何阻止 Laravel 5 缓存配置? [英] How to stop Laravel 5 from caching configurations?

查看:23
本文介绍了如何阻止 Laravel 5 缓存配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 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.phpstorage/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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆