开发者

How to store sessions with PHP

I am trying to create a PHP session class to store sessions. What is the best way to deal with sessions?

This is what I have so far:

class Sessions {

    function start() {
        session_start();
        $_SESSION['sid'] = randomstring();
        // insert session id into db
        // initialize user data
    }

    function destroy() {
        session_destroy();
        // delete开发者_开发百科 sid from db too
    }

    function update() {
        session_regenerate_id();
        // update lastaccess time in db
    }
}

What is the best way to store sessions in PHP?


This will answer your question of Session Handling? http://www.devshed.com/c/a/PHP/Storing-PHP-Sessions-in-a-Database/

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜