laravel config:cache 后的小坑


  laravel 使用 php artisan config:cache 后 系統就會讀取所有的配置文件集中到一起寫入緩存,那么如果代碼中 使用 env() 輔助函數獲取 .env 里面的配置項就不起作用了!!

引用文檔原話:If you execute the config:cache command during your deployment process, you should be sure that you are only calling the env function from within your configuration files. Once the configuration has been cached, the .env file will not be loaded and all calls to the env function will return null.


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM