【问题标题】:Rederict works only in specefic browsers重定向仅适用于特定浏览器
【发布时间】:2013-08-05 00:46:28
【问题描述】:

以下代码在 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>";    
    }

(...)

【问题讨论】:

标签: php internet-explorer google-chrome


【解决方案1】:

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

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

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

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

【讨论】:

  • 顺便说一句,rederict 不会为 url 使用 $MomentEvent 值...为什么?它只是显示它所写的网址......
  • 当你说它没有获得价值时,我并没有真正理解你的意思。你能澄清一下吗?
  • $MomentEvent 引用了我的 MySQL 表中的特定值,该值与用户信息一起输入。我希望该值位于 URL 中,以在唯一页面上显示一个用户的信息。
  • 代码正确显示 $MomentEvent 值。如果它没有出现在输出中,那么它不包含任何内容。
  • 我应该在前面放 $_GET(MomentEvent) 之类的东西吗?
猜你喜欢
  • 2017-12-28
  • 2020-04-14
  • 2013-07-13
  • 2019-10-27
  • 2015-09-15
  • 2021-07-06
  • 2016-10-18
  • 2013-02-26
  • 2011-10-16
相关资源
最近更新 更多