可能是session.save_path =  未设置好。
还有就是在此之前有输出。

解决方案 »

  1.   


    1、设置session.save_path = c:\temp 路径必须存在。
    2、session_start(); 请放在文件最前面,保证之前没有输出。
    3、header("location:index.php");之前也不能有输出。
      

  2.   

    本莱鸟已经照办了,还是有问题。注意我用的是IIS。
    程序改为:
    <?php
    session_cache_limiter ("nocache");
    session_start();
    session_register("stu_account","stu_pw");
    $db=mysql_connect("localhost","root"); 
    mysql_select_db("dbsystem",$db); 
    $result=mysql_query("SELECT passwd FROM student where username='$formval_username' ",$db); 
    if ($myrow = mysql_fetch_row($result)) 

    if($formval_passwd==$result)
        { print("登录成功!!");
    header("location:index.php");
     mysql_free_result($result);
         }
    else{ session_destroy();
          echo "密码错误,<a href=student.htm>请重新登录。</a>";
          }

    else
    { session_destroy();
    echo"该用户尚未注册!,<a href=student.htm>从新登录</a>";  

    ?> 
    <html>
    <body>
    </body>
    </html>出现问题如下:
    Warning: session_start() [function.session-start]: open(/\sess_273fd4720b3232eb2c083f70968748ec, O_RDWR) failed: Invalid argument (22) in g:\inetpub\wwwroot\system\checklogin.php on line 3Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at g:\inetpub\wwwroot\system\checklogin.php:3) in g:\inetpub\wwwroot\system\checklogin.php on line 3Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at g:\inetpub\wwwroot\system\checklogin.php:3) in g:\inetpub\wwwroot\system\checklogin.php on line 3Warning: session_destroy() [function.session-destroy]: Session object destruction failed in g:\inetpub\wwwroot\system\checklogin.php on line 22
    该用户尚未注册!,从新登录 
      

  3.   

    回复人:sandyuk(冰の沙隆) ( 五级(中级)) 信誉:100 2003-05-13 10:53:00 得分:0
    1、设置session.save_path = c:\temp 路径必须存在。
    2、session_start(); 请放在文件最前面,保证之前没有输出。
    3、header("location:index.php");之前也不能有输出。/edit php.ini file in */winnt/or win32
      

  4.   

    这是你的路径的问题,在php.ini里找到并改成 session.save_path = c:\temp  
    注意:
       1.在c:盘下要建立一个temp文件夹;
       2.改的那个路径前面没有“;”// 不是 ;session.save_path = c:\temp
      

  5.   

    第一种可能:在php.ini里找到并改成 session.save_path = c:\temp  
    注意:
       1.在c:盘下要建立一个temp文件夹;
       2.改的那个路径前面没有“;”// 不是 ;session.save_path = c:\temp第二种:
    将session_start();
    放在页面的最顶上去,试试!!