Header 在 Yii2 语法中
Header in Yii2 syntax
我无法更改 Yii2 语法:
header("Refresh: 60; url={$_SERVER['REQUEST_URI']}");
下面的代码不起作用:
$headers = Yii::$app->response->headers;
$headers->set("Refresh: 60", "url={$_SERVER['REQUEST_URI']}");
Header名称为Refresh
,其余为值。所以你应该使用:
$headers->set("Refresh", "60; url={$_SERVER['REQUEST_URI']}");
我无法更改 Yii2 语法:
header("Refresh: 60; url={$_SERVER['REQUEST_URI']}");
下面的代码不起作用:
$headers = Yii::$app->response->headers;
$headers->set("Refresh: 60", "url={$_SERVER['REQUEST_URI']}");
Header名称为Refresh
,其余为值。所以你应该使用:
$headers->set("Refresh", "60; url={$_SERVER['REQUEST_URI']}");