Last active
January 2, 2018 14:05
-
-
Save yusureabc/9a4c8379792420eed7f9e98701d3a68b to your computer and use it in GitHub Desktop.
配置php的session存储到memcache或redis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set("session.save_handler", "memcache"); | |
ini_set("session.save_path", "tcp://192.168.48.128:11211"); | |
session_start(); | |
if ( ! isset( $_SESSION['TEST'] ) ) | |
{ | |
$_SESSION['TEST'] = time(); | |
} | |
$_SESSION['yusure'] = time(); | |
$_SESSION['TEST3'] = time(); | |
var_dump( $_SESSION ); | |
var_dump( session_id() ); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ini_set("session.save_handler", "redis"); | |
ini_set("session.save_path", "tcp://192.168.48.128:6379?auth=123456"); | |
session_start(); | |
if ( ! isset( $_SESSION['TEST'] ) ) | |
{ | |
$_SESSION['TEST'] = time(); | |
} | |
$_SESSION['yusure'] = time(); | |
$_SESSION['TEST3'] = time(); | |
var_dump( $_SESSION ); | |
var_dump( session_id() ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment