我在编写 php 重定向时在 drupal6 中遇到以下问题。
问题是:
页面没有正确重定向 Firefox 检测到服务器正在以一种永远不会完成的方式重定向对该地址的请求。
这个问题有时可能是由于禁用或拒绝接受cookies造成的。
我写过这样的代码:
global $base_url,$user;
$uid = $user->uid;
$msg = "Please select your user type (capital provider or project sponsor) and agree to the terms and conditions. Then, you’ll be able to post and find capital or a project in which to invest.";
$url = $base_url."/editProfile?message=".$msg;
header("Location: $url");
您需要测试当前页面是否与您要重定向到的页面相同。
if (getCurrentPage() == "editProfile" && getCurrentMessage() == $msg) // THEN DO NOT REDIRECT