1. $_SESSION["admin"] = "good";
2. php.ini 中 session.save_path 设置不当

解决方案 »

  1.   

    谢谢两位的帮助,但还是不行.我运行下面代码:
    <?php 
    session_start(); 
    $_SESSION["admin"] = "good";
    $sessionName = session_name();
    $sessionID = $_GET[$sessionName];
    echo session_id($sessionID);
    ?>
    运行到session_id($sessionID);就返回同样错误,(如果注消"\\echo session_id($sessionID);"这行就什么也没返回,没错误信息提示)我已经在php.ini 中的设了
    session.save_path = c:/tmp 
    session.cookie_path = c:/tmp 
    并在C盘下建立了文件夹C:/tmp我的运行环境是win2000个人版 + php-5.0.5 + apache_2.0.5
    php.ini 中文件中,可找到3个设"session.save_path"的地方.从上到下分别是:
    ;session.save_path = "N;/path"
    session.save_path = "N;MODE;C/tmp"
    session.save_path = "C:/tmp"
    第一个好像是As of PHP 4.0.1用的,我没把分号去掉.我是不是还有什么地方没配好,还是哪个地方出错了,哪个知道的帮帮我啊,谢谢了!
    叹!没老师教的新手入门真难,配环境就够我晕了.
      

  2.   


    看手册的时候仔细点。
    很明显session_id 不加参数才是取当前的sessionid的嘛。
    --------------
    session_id -- Get and/or set the current session id
    Description
    string session_id ( [string id])
    session_id() returns the session id for the current session. If id is specified, it will replace the current session id. session_id() needs to be called before session_start() for that purpose. Depending on the session handler, not all characters are allowed within the session id. For example, the file session handler only allows characters in the range a-z, A-Z and 0-9! 
      

  3.   

    谢谢gu1dai
    我就是你说的那个地方出错了.
    叹!英语不好真难,看手册不知道里面说的是什么意思.