表单提交后的chrome重定向

时间:2013-02-25 19:05:02

标签: php google-chrome

自1小时以来,我正在努力解决这个简单的代码安静问题。 在表单提交后执行浏览器刷新时会出现问题。 Chrome浏览器想要重新提交表单。每个其他浏览器都像预期的那样工作。

是否有适用于Chrome的解决方法/黑客?

<?php
// file: test.php
if(isset($_POST['test'])){
    header('Location: test.php');
    exit;
}
?>
<form method="post">
    <input type="hidden" name="test" value="1">
    <input type="submit" value="Send">
</form>

1 个答案:

答案 0 :(得分:2)

试试这个:

<html>
<head>
<?php
if(isset($_POST['test'])){
echo "<meta http-equiv=refresh content='0;url=test.php'>";
exit();
}
?>
</head>
相关问题