我觉得应该是超时的原因吧!
; Lifetime in seconds of cookie or, if 0, until browser is restarted.
session.cookie_lifetime = 0; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
; WARNING: Your filesystem must store access times.  Windows FAT does
;          not.  So, see session_set_save_handler() and write your own
;          session handler with a different mechanism for cleaning up sessions.
session.gc_maxlifetime = 14400     ;等于三个小时。; NOTE: If you are using the subdirectory option for storing session files
;       (see session.save_path above), then garbage collection does *not*
;       happen automatically.  You will need to do your own garbage 
;       collection through a shell script, cron entry, or some other method. 
;       For example, the following script would is the equivalent of
;       setting session.gc_maxlifetime to 1440 (1440 seconds = 24 minutes):
;          cd /path/to/sessions; find -cmin +24 | xargs rm

解决方案 »

  1.   

    不管你是否关闭浏览器;你试试:
    -----------test.php---------
    <?
    session_start();
    session_register("theTempVar");
    $theTempVar = "This is a test";
    echo $theTempVar;
    ?>
    你多开几个窗口,打开 %dir%/test.php
    你再看看存放session临时文件的目录下,是否有多个sess_xxxxxxxx文件;
    无论你是否关闭部分浏览器,你看一下,它们什么时候会消失……试后请告诉结果!
      

  2.   

    做了楼上的测试我在单用户操作session的情况下,是一切正常的,开几个浏览器,就生成几个session。而且没有消失。至少在半小时里没有消失。然后我开了一个论坛,这个时候生成了2个session一个是0字节,另一个是正常的。
    我目前还没有办法进一步去测试,因为session不正常多数是发生在,有几个用户登入操作我的session时就会不正常,现在晚上没有人登入我的机器。
      

  3.   

    原来是apache和php本身问题升级后解决。