How to force clean browser cache laravel [closed]

亡梦爱人 提交于 2019-12-25 17:07:39

问题


Im new in web development. I just want to ask if how to force clean all cache in the browser using PHP.


回答1:


The best you can do is set a cache-control header, but you cannot "force" anything on client with a server-side language.

In laravel:

return view('some_template')->header('Cache-Control', 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0');

In plain php you would use header() function before outputting anything.

header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0');



回答2:


PHP is on server side. You have no control over browsers.



来源:https://stackoverflow.com/questions/37068359/how-to-force-clean-browser-cache-laravel

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