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
session_module_name -- Get and/or set the current session module我的 session_module_name是 “files” 估计session_module_name是表示session在服务器上存储的方法。
网上的:
session_register 注册变量
session_name session名称
session_module_name session模块名我主要是不知道模块是指什么?
---------------test.php-----------------------
<?php
session_start();
session_register('yourname');
$yourname="ykj76";
?>
--------------------test1.php--------------------
<?php
session_start();
echo $yourname;
?>
可是这么多人回复,我还是不知道session module是指什么?
-_-
(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
session_module_name是 “files”
估计session_module_name是表示session在服务器上存储的方法。