Laravel8 配置修改不生效,缓存问题解决方案

Laravel 发布到服务器上之后,后面修改了配置后,页面读取的还是旧的配置。 最终问题解决是通过执行如下命令清除配置缓存

1
2
3

php artisan config:clear

https://laravel.com/docs/8.x/deployment#optimizing-configuration-loading

这个问题在官网文档已经说明,仔细阅读文档

When deploying your application to production, you should make sure that you run the config:cache Artisan command during your deployment process:

1
2
php artisan config:cache

If you are building a large application with many routes, you should make sure that you are running the route:cache Artisan command during your deployment process:

1
2
php artisan route:cache