How to force clean browser cache laravel [closed]

2019-09-20 10:46发布

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

2条回答
唯我独甜
2楼-- · 2019-09-20 11:13

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');
查看更多
小情绪 Triste *
3楼-- · 2019-09-20 11:16

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

查看更多
登录 后发表回答