Laravel 8 config:cache 允许发送电子邮件,但在 config:cache 之后无法读取环境变量

发布于 2025-01-10 03:30:19 字数 348 浏览 3 评论 0原文

希望你们一切都好。当我运行命令

php artisan config:cache

电子邮件正在发送但我无法读取 env( 'DB_HOST') 变量。

同样,当我这次运行时:

php artisan config:clear

email is not send, now I can read env('DB_HOST ') 变量。

我不明白什么是问题。

hope you are all fine. I am facing an issue when I am running command

php artisan config:cache

email is sending but I can't read env('DB_HOST') variables.

Similarly when I run then this time:

php artisan config:clear

email is not sending, now I can read env('DB_HOST') variables.

I don't understand what is issue.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

年华零落成诗 2025-01-17 03:30:19

阅读此https://laravel.com/docs/8.x/configuration#配置缓存

您必须使用相应的配置。在你的情况下

config('database.connections.mysql.host')

Read this https://laravel.com/docs/8.x/configuration#configuration-caching

You must be use correspond config. IN your case

config('database.connections.mysql.host')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文