session_register在变量赋值前使用
session_name在变量赋值后使用

解决方案 »

  1.   

    你的解释怎么和网上的解释完全不同?
    网上的:
      session_register    注册变量
      session_name        session名称
      session_module_name session模块名我主要是不知道模块是指什么?
      

  2.   

    Session指的就是用户在浏览某个网站时,从进入网站到浏览器关闭所经过的这段时间,也就是用户浏览这个网站所花费的时间。从上述的定义中我们可以看到,Session实际上是一个特定的时间概念。 一般来说,在网站上某一个页面中的变量(指服务器端变量)是不能在下一页中用的,有了session就好办了。session中注册的变量可以作为全局变量使用。这样我们就可以将session用于用户身份认证,程序状态记录,页面之间参数传递。 
      

  3.   

    那对于PHP的函数 session_module_name(),session module是指什么?
      

  4.   

    要用sesseion时,你必须把session_start();放在最近面!然后注册你的变量用session_register('你的变量');然后给变量赋值$你的变量="赋值";调用时只要在最前面写上session_start();就可以调用了!举例如下:
    ---------------test.php-----------------------
    <?php
    session_start();
    session_register('yourname');
    $yourname="ykj76";
    ?>
    --------------------test1.php--------------------
    <?php
    session_start();
    echo $yourname;
    ?>
      

  5.   

    首先谢谢回复的人.
    可是这么多人回复,我还是不知道session module是指什么?
    -_-
      

  6.   

    session_module_name
    (PHP 4 )session_module_name -- Get and/or set the current session module
    Description
    string session_module_name ( [string module])
    session_module_name() returns the name of the current session module. If module is specified, that module will be used instead. User Contributed Notes
    session_module_name  
    kaufmann at cyland dot com
    21-Jul-2000 12:05 
     
    Read http://www.zend.org/zend/tut/session.php ...
     
     
    michael at michaelsmacshack dot com
    01-Aug-2000 06:38 
     
    <pre>First I have read the documentation both on this site and at ZEND. 
    The test case was taken from the artical "PHP4 Customer Session 
    Handler Test Script" by Ying Zhang ([email protected]) at the 
    HTTP://www.phpbuilder.com site. This is a complex issue.  It would be reasonable to expect PHP4 to 
    behave according to what is set in PHP.ini as a default.... 
    The following are my results using PHP4.0.1pl2. 1) With 'session.save_handler' not defined (commented out):    The online documentation for the session_module_name states that 
       the 'module' can be set in the call: 
             "session_module_name() returns the name of the current 
              session module. If module is specified, that module 
              will be used instead." 
              
       Any attempt to do so results in an error regardless of whether 
       or not any handler has been defined by the user: 
         Fatal error: Failed to initialize session module in 
          .../handler/test.php on line 38   
           This occurs at the session_start() call. 
        
       Not setting a 'module' will return the current handler.  With 
       nothing defined in PHP.ini, a value of 'files' is returned. 
        
       If you define your 'user' handlers and call 'session_set_save_handler' 
       before the 'session_module_name' call, a value of user is returned. 
       However, any variables registered in this session Do Not maintain 
       their value.  It is like the handlers are accepted, but are not used. 
      
       Thus, not having 'session.save_handler' defined in PHP.ini does not 
       help.  However, the 'files' modules does work (e.g. no defined user 
       handlers) in this situation. 
        
    2)  If we define 'session.save_handler' in PHP.ini with a value of 'files', 
       then the same results as above occur. 
        
       Thus in this case, we have explicitly defined the handler as file and 
       the only thing that works is the 'files' module. 
        
    3)  If we define the 'session.save_handler' in PHP.ini with a value of 
       'user', then things change to the opposite.  You must define an 
       user handler. If you do not, registered variables are not retained. 
        
      Thus the 'user' module dos work in this case and the variables are 
      passed from invocation to invocation. 
        
    This leaves us with the following: 
       a.  One handler method can be defined at a time.  And only one. 
       b.  There is a very tight coupling between the PHP.ini file and 
           what can be done by the programmer. 
          
    Conclusions.  You can get a 'user' handler defined to track the session 
    data in a database.  But, it must be only one way for all applications. 
    (It could be different databases for different applications however.) 
    It would seem that this is wrong.  It should be reasonable to define one 
    behavior for one application and another for others. I hope this has help to clear up a few questions.</pre>
     
     
    tim dot parkin at btinternet dot com
    27-Oct-2000 04:56 
     
    A feature(?) that may not be documented is the fact that when over-riding the session-handler, (not forgetting to set save_handler in the php.ini file), the session write function is only called AFTER the apache output stream is closed. What this means is that any debugging, output to screen or errors thrown within the session_write function WILL NOT GET DISPLAYED. The only way to debug the session write function is to use error logging to a file (setting in the php.ini file). This managed to cause me hours of frustration. Hope this helps
     
     
      

  7.   

    session_module_name -- Get and/or set the current session module我的
    session_module_name是 “files”
    估计session_module_name是表示session在服务器上存储的方法。