The code is provided by the Trace Memory blog
PHP rewrite session mechanism
How to use:
$session = new Onmpwsessionhandler ($config); Session_set_save_handler ($session, true);
Where parameter $config is the configuration option
$config = Array ( ' save_handle ' = ' Redis ', ' HOST ' = ' 127.0.0.1 ', ' PORT ' =>6379, ' AUTH ' = NULL, //whether there is user authentication, no password authentication by default. If not NULL, then verify password ' timeout ' =>0, //Connection Timeout ' RESERVED ' =>null, ' Retry_interval ' =>100, // The unit is MS Ms ' reconnect ' =>false,//connection timeout is not re-connected by default;
Use examples such as the following
Include ' onmpwsessionhandler.php '; $session = new Onmpwsessionhandler (Array ( ' HOST ' = ' 192.168.5.111 ', ' PORT ' =>6379); Session_set_save_handler ($session, True); Session_Start (); $_session[' name '] = ' ONMPW ';
For a rewrite of the session mechanism, refer to the article "PHP rewrite session mechanism"