代码之家  ›  专栏  ›  技术社区  ›  Kevin Lewis

在添加html后使用php打开页面

  •  1
  • Kevin Lewis  · 技术社区  · 6 年前

    我正在运行一个php代码来处理一个表单并将您发送到另一个页面。当我的处理完成后,我正在使用此代码作为示例:

    echo "Success, redirecting to <a href = "index.html">index.html</a>";
    //I then do some stuff with the session here
    echo "<script>window.open('index.html', '_self')</script>";
    

    我觉得这不是最有效的管理方式。可以用普通php打开新页面吗?(页眉位置不起作用,因为第一条回显行定义了页面)。或者,有没有一种方法可以对报头位置做同样的事情,并以不同的方式显示早期的回音行,但仍然具有相同的效果?

    1 回复  |  直到 6 年前
        1
  •  1
  •   idanoo    6 年前

    在将数据发送回浏览器后,您不能使用PHP来执行此操作。

    我个人会加上 setTimeout() 然后运行 window.open() 5000ms后。