重定向仅适用于特定浏览器

时间:2013-08-04 01:54:21

标签: php internet-explorer google-chrome

以下代码在Chrome中正确重新编写,但在IE中却没有...为什么?

(...)
$x = mysql_real_escape_string($_POST['x']);
$x = mysql_real_escape_string($_POST['x']);
$x = mysql_real_escape_string($_POST['x']);
$x = mysql_real_escape_string($_POST['x']);
$MomentEvent = mysql_real_escape_string($_POST['MomentEvent']);

     {
    $registerquery = mysql_query("INSERT INTO users_event (x, x, x, x, x, MomentEvent) VALUES('".$x."', '".$_SESSION ['x']."', '".$x."', '".$x."', '".$x."', '".$confirm_code=md5(uniqid (rand())). "'); ");
    if($registerquery)
    {
        echo "<h1>XXXX</h1>";
        echo "<p>XXXXX</p>";          
        echo "<meta http-equiv='refresh' content='0;show2.php?MomentEvent=<?php echo $MomentEvent ?>' />";
}
    else
    {
        echo "<h1>Error</h1>";
        echo "<p>Sorry, your registration failed. Please go back and try again.</p>";    
    }

(...)

1 个答案:

答案 0 :(得分:2)

我认为你最好使用header()函数为重定向发送适当的HTTP标头,如下所示:

header( "show2.php?MomentEvent=" . $MomentEvent );

如果您想坚持使用当前使用的方法,则需要包含URL=属性,因此它看起来像这样:

<meta http-equiv='refresh' content='0;URL=show2.php?MomentEvent=<?php echo $MomentEvent; ?>' />