PHP标头在localhost上工作但在实时服务器上没有

时间:2014-01-25 10:05:31

标签: php session header

这是我的php页面..如果有人直接访问此页面,如果未设置值,则会读取会话值,然后重定向到page.html。否则会打印一些消息。这适用于本地主机,但不适用于实时服务器。

<?php 
session_start();
$name = $_SESSION['team']; //a value stored in session which i used on this page  

if (($_SESSION["abc"] !== 'good')) {
    header('Location: http://www.abc.com/page.html');
}
else{
echo $name. 'you have completed register process part one you may continue!';
}
?>

1 个答案:

答案 0 :(得分:0)

Use This


<?php 

session_start();
$name = $_SESSION['team']; //a value stored in session which i used on this page  

if (($_SESSION["abc"] !== 'good')) {
?>
  <script>
    window.location = "http://www.abcd.com/page.html";
  </script>
<?php
}
else{
echo $name. 'you have completed register process part one you may continue!';
}
?>