PHP会话ID问题

问题描述:

我有一个网站,并且在我刷新页面之前网站上的内容不会显示。PHP会话ID问题

我发现在我的代码session_start();如果我删除我的PHP会话ID我的网页上的东西再次消失,似乎这个会话需要设置第一页加载......有谁知道如何做到这一点?

顺便说一下,没有出现的东西是一种形式,一种GET形式。

感谢

这里是与会话

function wpsc_core_load_session() { 
    if (!isset($_SESSION)) 
     $_SESSION = null; 

    if ((!is_array($_SESSION)) xor (!isset($_SESSION['nzshpcrt_cart'])) xor (!$_SESSION)) 
     session_start(); 
} 

的代码,他是什么犯规显示

<form class="product_search" style="font-size:0px !important;" method="GET" action="<?php echo $pp_url?>/" > 
       <input name="product_search" id="wpsc_search_autocomplete" class="wpsc_product_search wpsc_live_search_embed .wpsc_live_search" autocomplete="off" style="padding:0px !important; height:25px !important; vertical-align:top;" /> 
       <script type='text/javascript' > /* <![CDATA[ */ 
        jQuery('#wpsc_search_autocomplete').keypress(function(e){ 
         if (e.keyCode == 13) { 
          var url = '<?php echo $pp_url ?>'+'?product_search='+jQuery(this).val(); 
          url = encodeURI(url); 
          jQuery(window.location).attr('href', url); 
         } 
        }); 
        /* ]]> */ 
        </script> 
        <input type="submit" id="button" name="button" class="searchBtn" value="GO"/> 
      </form> 

我打开我的WordPress的调试器,这是一出

Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/content/19/9468119/html/wp-content/plugins/jquery-colorbox/jquery-colorbox.php:34) in /home/content/19/9468119/html/wp-content/plugins/wp-e-commerce/wpsc-core/wpsc-constants.php on line 13 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/content/19/9468119/html/wp-content/plugins/jquery-colorbox/jquery-colorbox.php:34) in /home/content/19/9468119/html/wp-content/plugins/wp-e-commerce/wpsc-core/wpsc-constants.php on line 13 

,当一个丢失的形式是有出现此消息....

Notice: A session had already been started - ignoring session_start() in /home/content/19/9468119/html/wp-content/plugins/wp-e-commerce/wpsc-core/wpsc-constants.php on line 18 
+2

您能否将代码添加到问题中? – andrewsi

+0

-1,什么?我已经浏览了你的堆栈溢出历史,并且你可以把一个完整的思想放在一起。这个问题并没有显示出这个技能。如果您重新提示,并且可能会显示一些代码,那么为您获得答案将会有很长的路要走。 – Jeremy1026

+0

我很抱歉我之前缺乏代码。 – user979331

你有一个根本的问题:

if (!isset($_SESSION)) 
    $_SESSION = null; 

if ((!is_array($_SESSION)) xor (!isset($_SESSION['nzshpcrt_cart'])) xor (!$_SESSION)) 
    session_start(); 

它启动之前,您不能访问会话。尝试启动它,然后访问它...

也xor是一个按位比较...我不知道如果这就是你在这里寻找,也许||是。

它似乎像这个会话需要设置在首页加载...有谁知道如何做到这一点?

通常情况下,首页加载用脚本的顶部或输出标题之前的任何运行来表示,但自从你的新版本我只会在顶部说。尝试把它放在那里。

最有可能你收到一个错误,并得到display_errors关闭,因为你得到一个空白页,我认为。

+0

即时消息非常新,当涉及到这个东西....什么,我只是把这个代码之前session_start()? – user979331

+0

@ user979331是啊放在你的脚本的顶部,它会做它的工作 – Sammaye

+0

我把它放在我的功能的顶部,并没有工作....生病尝试把session_start()在我的标题 – user979331