【PHP】Session共享
一、核心:redis接管Session
if(C('SESSION_TYPE')) { $type = C('SESSION_TYPE'); $class = strpos($type,'\\')? $type : 'Think\\Session\\Driver\\'. ucwords($type); $hander = new $class(); session_set_save_handler( array(&$hander,"open"), array(&$hander,"close"), array(&$hander,"read"), array(&$hander,"write"), array(&$hander,"destroy"), array(&$hander,"gc")); }
二、api.com域名
设置session
返回session_id
三、www.com域名
session_write_close(); # 暂停Session
session_id('api返回的session_id'); # 设置session_id
session_start(); # 这时候会从新的SessionId的缓存中读取数据
得意时做事,失意时读书