WordPress » 总有你想不到的东西 imag1
 
 
总有你想不到的东西

session-set-save-handler.php

session_set_save_handler

(PHP 4, PHP 5)
session_set_save_handler — Sets user-level session storage functions
Description
bool session_set_save_handler ( callback open, callback close, callback read, callback write, callback destroy, callback gc )

session_set_save_handler() sets the user-level session storage functions which are used for storing and retrieving data associated with a session. This is most useful when a storage method other than those supplied by PHP sessions is preferred. i.e. Storing the session data in a local database. Returns TRUE on success or FALSE on failure.

Note: The “write” handler is not executed until after the output stream is closed. Thus, output from debugging statements in the “write” handler will never be seen in the browser. If debugging output is necessary, it is suggested that the debug output be written to a file instead.

The following example provides file based session storage similar to the PHP sessions default save handler files. This example could easily be extended to cover database storage using your favorite PHP supported database engine.

Read function must return string value always to make save handler work as expected. Return empty string if there is no data to read. Return values from other handlers are converted to boolean expression. TRUE for success, FALSE for failure.

matt at openflows dot org
19-Sep-2006 08:02

Note that for security reasons the Debian and Ubuntu distributions of php do not call _gc to remove old sessions, but instead run /etc/cron.d/php*, which check the value of session.gc_maxlifetime in php.ini and delete the session files in /var/lib/php*. This is all fine, but it means if you write your own session handlers you’ll need to explicitly call your _gc function yourself.

http://xoops.org.cn/modules/newbb/viewtopic.php?topic_id=10736

请部xoops_session是管什么的,我这个表里插入的数据竟有12M之多,能不能删除?如何能让它不再增肥?

session: Paisley Polka Dot Picnic Party #6session: Paisley Polka Dot Picnic Party #9session: Paisley Polka Dot Picnic Party #4

1条评论

  1. 评论 由 xjwjl:

    ?

发表评论

抱歉,您必须登录后才可以发表评论。