我有这段代码可以用来刷新浏览器缓存。
<html lang="en">
<?php header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); ?>
<head>
<link rel="icon" href="//goak.it/unnamed.ico" type="image/ico" />
<meta charset="utf-8">
<!--<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">-->
<meta name="keywords" content="">
<meta name="description" content="">
问题是它给了我这个错误:
Cannot modify header information - headers already sent by (output started at /home/weuxfyre/app/models/User.php:1) (View: /home/weuxfyre/app/views/header.blade.php) (View: /home/weuxfyre/app/views/header.blade.php)
通过控制代码,但我没有看到当前的输出。有人能帮助我吗?我感谢可能的帮助。
答案 0 :(得分:0)
我认为你只需要将标题代码移到开始标记之上。
答案 1 :(得分:0)
您的代码
<html lang="en">
<?php header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
在第一次标头调用之前,您有一个起始<html
标记。输出此起始HTML标记。将输出任何起始标记或模板中的字符。您不应在模板中设置标头,应在Route::...
回调或控制器操作中设置它们。