开发者

Does somebody have a working sample of PHP session_set_save_handler?

开发者 https://www.devze.com 2022-12-24 13:08 出处:网络
PHP Version 5.1.6 All day trying..I\'m breaking my head now... I understand it but can\'t ma开发者_运维技巧ke it work. I need to store the session data in a mysql database, cause we\'re balancing the

PHP Version 5.1.6 All day trying..I'm breaking my head now... I understand it but can't ma开发者_运维技巧ke it work. I need to store the session data in a mysql database, cause we're balancing the request among 2 servers, so regular sessions wont work... I need to use this function ... session_set_save_handler ... and I cant make it work..any help greatly appreciated it. Thank you !


If you look at the comments on the PHP documentation page for session_set_save_handler(), you can see a full copy of a class that will store the session data into a database.

The basic database schema involves 3 columns: Session ID, Session Data, and Session Timestamp

The Session ID and Session Data are the critical ones, as PHP gives you both. Session ID is a random ID, and Session Data is a serialize()-like string that represents session data.

The timestamp is simply for you figuring out when to delete it.

I also have an old working copy of a Session Handler here in one of my old frameworks.


Full script available at:

http://forums.devnetwork.net/viewtopic.php?t=23781

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号