Consider the following questions first:
Disable cookie,session can I use it?
How to store the session storage database/memcached/redis
How do I implement a strict 30-minute expired session? 、
How do I practice session sharing for a Web server cluster?
How do you implement session sharing for two different domain sites?
Answer: Yes!
The relationship between a cookie and a session
The cookie is passed session_id for the server to determine the session file.
So as long as can be passed to the server session_id,session can be used normally.
And a cookie is just a way of passing session_id.
SESSION_ID can also be passed with a URL
The php.ini configuration is as follows:
session.use_only_cookies = 0
Session.use_trans_sid = 1
It's OK.
Implementation code:
class sess { protected static $mem = null; public static function open () { if (self:: $mem === null) { self:: $mem = new memcache (); self:: $mem->connect (' localhost ' , 11211); } } public static function close () { self:: $mem->close (); } public static function read ($id) { return self:: $mem->get ($id); } public Static function write ($id , $data) { return self:: $mem->add ($ ID, $data , false); } public static function destroy ($id) { return self:: $mem->delete ($id );     }    PUBLIC STATIC FUNCTION GC ($lifetime) { // }}session_set_save_handler (' Sess::open ', ' sess::close ', ' sess::read ', ' sess::write ', ' sess::d estroy ', ' SESS::GC ') ;
PHP Session Implementation principle