session_id
(PHP 4 )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! The constant SID can also be used to retrieve the current name and session id as a string suitable for adding to URLs. Note that SID is only defined if the client didn't sent the right cookie. See also Session handling. 
这是PHP中文手册中的一段,试一下吧.

解决方案 »

  1.   

    要实现Session的永久生命期,首先需要了解一下php.ini关于Session的相关设置(打开php.ini文件,在“[Session]”部分): 
    1、session.use_cookies:默认的值是“1”,代表SessionID使用Cookie来传递,反之就是使用Query_String来传递; 
    2、session.name:这个就是SessionID储存的变量名称,可能是Cookie,也可能是Query_String来传递,默认值是“PHPSESSID”; 
    3、session.cookie_lifetime:这个代表SessionID在客户端Cookie储存的时间,默认是0,代表浏览器一关闭SessionID就作废……就是因为这个所以Session不能永久使用! 
    4、session.gc_maxlifetime:这个是Session数据在服务器端储存的时间,如果超过这个时间,那么Session数据就自动删除! 
    还有很多的设置,不过和本文相关的就是这些了,下面开始讲使用永久Session的原理和步骤。 前面说过,服务器通过SessionID来读取Session的数据,但是一般浏览器传送的SessionID在浏览器关闭后就没有了,那么我们只需要人为的设置SessionID并且保存下来,不就可以…… 
    如果你拥有服务器的操作权限,那么设置这个非常非常的简单,只是需要进行如下的步骤: 
    1、把“session.use_cookies”设置为1,打开Cookie储存SessionID,不过默认就是1,一般不用修改; 
    2、把“session.cookie_lifetime”改为正无穷(当然没有正无穷的参数,不过999999999和正无穷也没有什么区别); 
    3、把“session.gc_maxlifetime”设置为和“session.cookie_lifetime”一样的时间
      

  2.   

    驴唇不对马嘴
    上面说的都不对
    session 是系统生成的
    但是session_id()函数不能
    具体怎么能让session id让你说了算。我估计是没有
    你还是问问
    带星号的那几个人吧
    他们知道的多点