哟?奇怪了哈~~~我把代码完全拷下来在我自己的机器上是完全正常通过了的,可以得到
s_username:guest
的结果。你的机器上的session物理文件也是发送了~~怎么会读不到了,总不能有写权限而没读权限吧~~搞笑?你试试在t2.php中直接echo $s_username ?

解决方案 »

  1.   

    一个问题,第一次执行时显示 对不起,您无此权限!,第二次执行(在同一浏览器内)才显示s_username:guest原因?跟session_save_path有关系吗?或者,浏览器?!
      

  2.   

    也就是说在session第一次被存储的时候不能被读取?这个问题我很久以前好象遇见过一次~~都不记得当时是怎么处理的了~~:P再仔细看看你的php.ini里关于session的设置?这是我的:[Session]
    session.save_handler      = files   ; handler used to store/retrieve data
    session.save_path         = C:\Program Files\nusphere\apache\php\tmp    ; argument passed to save_handler
                                        ; in the case of files, this is the
                                        ; path where data files are stored
    session.use_cookies       = 1       ; whether to use cookies
    session.name              = PHPSESSID  
                                        ; name of the session
                                        ; is used as cookie name
    session.auto_start        = 0       ; initialize session on request startup
    session.cookie_lifetime   = 0       ; lifetime in seconds of cookie
                                        ; or if 0, until browser is restarted
    session.cookie_path       = /       ; the path the cookie is valid for
    session.cookie_domain     =         ; the domain the cookie is valid for
    session.serialize_handler = php     ; handler used to serialize data
                                        ; php is the standard serializer of PHP
    session.gc_probability    = 1       ; percentual probability that the 
                                        ; 'garbage collection' process is started
                                        ; on every session initialization
    session.gc_maxlifetime    = 1440    ; after this number of seconds, stored
                                        ; data will be seen as 'garbage' and
                                        ; cleaned up by the gc process
    session.referer_check     =         ; check HTTP Referer to invalidate 
                                        ; externally stored URLs containing ids
    session.entropy_length    = 0       ; how many bytes to read from the file
    session.entropy_file      =         ; specified here to create the session id
    ; session.entropy_length    = 16
    ; session.entropy_file      = /dev/urandom
    session.cache_limiter     = nocache ; set to {nocache,private,public} to
                                        ; determine HTTP caching aspects
    session.cache_expire      = 180     ; document expires after n minutes
    session.use_trans_sid     = 1       ; use transient sid support if enabled
                                        ; by compiling with --enable-trans-sid
    url_rewriter.tags         = "a=href,area=href,frame=src,input=src,form=fakeentry"
      

  3.   

    你好像应该先赋值,再注册.试试:t1.php
    <?
        session_start(); 
        $s_username="guest";
        session_register("s_username");
        Header("Location: t2.php");  
    ?> 
    如何?
      

  4.   

    2 宇凡
    session的设置没错2 天酬
    一样,第二次执行时才见得到值:(
      

  5.   

    主  题:SESSION变量哪去了??!!
    作  者:abcat
    所属论坛:PHP
    问题点数:20
    回复次数:7
    发表时间:2001-11-5 15:09:33
     
      
      t1.php
    <?
        session_start(); 
        session_register("s_username");
        $s_username="guest";
        echo "注册成功,请点击<a href=t2.php>此处</a>进入t2.php";
        //Header("Location: t2.php"); 
    ?>  //这样是可以的,哪位给解释一下原因?如果要让它自动跳转呢?除了用header()还有啥法子?  谢谢则个,,
      

  6.   

    你的意思是问题出在header上?除了用php的header()函数还可以使用js的window.location.href和html的<mate>标签来转向
      

  7.   

    <SCRIPT LANGUAGE="JavaScript">
    <!--
    window.location.href="123.php";
    //-->
    </SCRIPT><meta http-equiv="refresh" content="0;URL=123.php">
      

  8.   

     session_start();
     session_register(userid);
     session_register(submit1);
     if ($SUBMIT=="TRUE"){
      $submit1="TRUE";
     $userid=$useracid;