【发布时间】:2014-01-20 15:48:39
【问题描述】:
我在 form.php 文件中有一个带有登录表单的页面,当我按下确定时,它调用文件 post_form.php 来检查插入的数据。如果数据没问题,我必须自动打开文件confirm.php,我该怎么做?
【问题讨论】:
-
如果我直接调用confirm.php会发生什么?
我在 form.php 文件中有一个带有登录表单的页面,当我按下确定时,它调用文件 post_form.php 来检查插入的数据。如果数据没问题,我必须自动打开文件confirm.php,我该怎么做?
【问题讨论】:
您可以只使用 PHP 的header() 函数。
但请确保在header() 调用之前没有输出,否则会失败。
if(HERE YOUR CONDITION) {
header("Location: confirm.php");
}
【讨论】:
ob_clear(); //Make sure you've done ob_start() or not output anything to the browser
header('Location: confirm.php');
exit;
【讨论】:
put header("位置:confirm.php");在你的 if 条件下。
【讨论】: