header() 位置在服务器上不起作用,但它在本地主机中工作


the header() location is not working on the server but it works in the localhost

这是我的代码....它的查询正在工作,但标头()中存在问题。请帮忙...

$d=mysql_query("SELECT * FROM admin where ad_email='{$_POST['email']}'");
    $row=mysql_fetch_object($d);
    $fid=$row->ad_email;
    $fpass=$row->password;
    if($fid==$_POST['email'] && $fpass==$_POST['password'])
      {
       $_SESSION['admin']=$_POST['email'];
       header("location: http://www.myhostexampl.co.in/alprofile.php");
       exit();
      }
     else
      {
       echo 'invalid id or pass';
      }

希望这对您有所帮助。而不是使用 header('location:your_url_to_redirect'); 尝试使用 header('Location:your_url_to_redirect');

仍然如果它不起作用,请尝试使用以下代码:

echo '<script type="text/javascript"> window.location = "your_url_to_redirect";</script>';

Location:必须以大写 L 开头,并且后面必须有一个空格:它应该像

header('Location: http://www.example.com/');