PHP rewrite session mechanism code sharing

Source: Internet
Author: User
PHP rewrite session mechanism code sharing code provided by Zhiyi blog

PHP rewrite session mechanism

Usage:

$ Session = new onmpwSessionHandler ($ config); session_set_save_handler ($ session, true );

$ Config is the configuration option.

$ Config = array ('SAVE _ handle' => 'redis', 'host' => '2017. 0.0.1 ', 'port' => 6379, 'auth' => null, // whether user verification exists. no password verification is performed by default. If it is not null, the verification password 'timeout' => 0, // connection TIMEOUT 'reserved' => null, 'retry _ interval' => 100, // The unit is MS millisecond 'reconnect '=> false, // whether the connection timed out is reconnected by default, not reconnected );

Example

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 details about how to rewrite the session mechanism, refer to the article "rewrite the session mechanism in PHP ".

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.