Laravel 4 not refreshing

試著忘記壹切 提交于 2019-12-30 07:42:29

问题


I have a strange issue in laravel 4 as each time I try to refresh the page changes doesn't appear . For sure it's not browser's cache . Any help appretiated


回答1:


I was having the same issues and found an answer:

Try disabling OPcache in your php.ini

If you use MAMP, it can be found at /Applications/MAMP/bin/php/php5.5.3/conf/php.ini

And dont forget to restart MAMP.




回答2:


I had a similar problem with the back-button, finally i noticed, that in my Laravel project no Cache-Control header was sent. The browser decided to cache this page and didn't do a new request.

To send this header, you can modify the app/filters.php file like this:

App::after(function($request, $response)
{
  $response->headers->set('Cache-Control', 'no-store, no-cache, must-revalidate');
  $response->headers->set('Pragma', 'no-cache');
}



回答3:


Did you tried - composer dump-autoload and - php artisan dump-autoload From the document root ?




回答4:


This could be a problem with the cache engine. If you updated via composer, try getting /app folder updates from github (especially config files), sometimes there are changes in files in that folder. You could also try to chmod 777 storage folder.




回答5:


Sometimes OPcache method isn't working, I use this code to make sure all changes are visible every time the page is loaded:

in app/filters.php add this in App::before(function($request)

$cachedViewsDirectory=app('path.storage').'/views/';
    $files = glob($cachedViewsDirectory.'*');
    foreach($files as $file) {
        if(is_file($file)) {
            if($file!='.gitignore') {
                @unlink($file);
            }
        }
    }


来源:https://stackoverflow.com/questions/17761984/laravel-4-not-refreshing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!