PHP会话问题

PHP会话问题,php,session,Php,Session,以下是我的脚本: if($redirect==1) { ?> <script> setTimeout("gotoLink()",1000); function gotoLink() { location.href='wycomments.php'; } </script> <?php $_SESSION['BROADCAST_DOWNLOAD']=1; } ?> if

以下是我的脚本:

if($redirect==1)
{
?>
    <script>
    setTimeout("gotoLink()",1000);
    function gotoLink()
   {
        location.href='wycomments.php';
  }
    </script>

<?php           
 $_SESSION['BROADCAST_DOWNLOAD']=1; 
}
?>
if($redirect==1)
{
?>
setTimeout(“gotoLink()”,1000);
函数gotoLink()
{
location.href='wycoments.php';
}
为什么我没有在wycomments.php上获得$\u会话['BROADCAST\u DOWNLOAD']


请提供帮助。

如果没有看到完整的代码,您似乎没有打电话

session_start();
在php页面中,以便可以使用
$\u会话
对象


你确定这些事情吗

  • 您是否在
    wycoments.php
  • 您是否在此代码示例文件中声明了会话
  • 如果我将
    $\u SESSION
    放在
    开始上方,会有什么问题
  • if($redirect==1)
    {
    $\会话['BROADCAST\ u DOWNLOAD']=1;
    setTimeout(“gotoLink()”,1000);
    函数gotoLink()
    {
    location.href='wycoments.php';
    }
    }
    

    我认为你取消了会议,所以你没有得到结果。。。
    do
    session_start();
    in
    wycomments.php
    page

    session_start();应位于需要使用Sessional请求的所有页面上,并通过启动会话的公共文件。由于session_start(),因此没有问题。保留它
     if($redirect==1)
      {
         $_SESSION['BROADCAST_DOWNLOAD']=1; 
          <script>
         setTimeout("gotoLink()",1000);
         function gotoLink()
          {
               location.href='wycomments.php';
          }
         </script>
      }