问题
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