If you are using the config:cache command during deployment, you must make sure that you are only calling the env function from within your configuration files, and not from anywhere else in your appelsecation.
If you are calling env from within your application, it is strongly recommended you add proper configuration values to your configuration files and call env from that location instead, ing you to your sours configur toyour to ite you toal ing you.
官方的建議是,在config裡面呼叫env,在別的地方呼叫config。
這其實是個大坑,我第一次寫laravel的時候就發現這個env在控制器裡面就是讀不出來。 (也不是百分之百讀不出來,是執行了 php artisan config:cache 之後讀不出來)
Laravel 有輔助函數
env()
呀= =