问题
Weird problem I'm having with Laravel 5.5
I can update and even delete a controller and yet it appears as if a cached / old version is still being called.
I've tried clearing cache, clearing route cache, clearing config cache - doesn't seem to have any effect.
On my local test environment if I delete the controller file then try to access it I immediately get a not found error. On my production server I do not.
Anyone have any ideas or advice?
回答1:
You can try running:
php artisan clear-compiled
and
composer dump-autoload
and
php artisan route:cache
and if you are running queues:
php artisan queue:restart
Also be aware the errors you are getting might be different depending on APP_ENV
or APP_DEBUG
in your .env
file but maybe that's not the case.
回答2:
I had the same problem. As for me, the reason was in composer classLoader.
composer clear-cache
composer dump-autoload
回答3:
Alright don't know what the problem was but deleting the 'Http' directory in 'App' and re ftping did the trick.
回答4:
I had the same problem once, because i had placed a "CustomController2" along with a "CustomController", just because i didn't want to the delete the previows one in case of failure.
I deleted the second one and cleared the route cache, and the problem was fixed.
回答5:
I had the same problem because of htaccess. I commented this line and problem solved:
ExpiresDefault "access 2 days"
Files were cached by browser:
## EXPIRES HEADER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
##ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES HEADER CACHING ##
回答6:
In my case, I did as suggested by the other solutions contributed here but nothing happened. I had to refresh the Wamp Server I was using and that was it, it started working fine again.
来源:https://stackoverflow.com/questions/47904156/is-there-some-sort-of-laravel-controller-cache