开发者

How to set sessions accessible to all browsers in the computer

I believe that sessions are stored in the server and cookies are stored in the browser. I'm using the function below to create a session:

function create_session($username, $ip){
    global $strings;
    开发者_运维知识库$unique_id = $strings->get_unique_id($username, $ip);
    $_SESSION['log_users'][] = array('username'=>$username, 'uid'=>$unique_id);

}

But when I tried to output the session in another browser, I didn't see anything:

print_r($_SESSION['log_users']);

I can only see it when inside the same browser where the session is created. Is this how its supposed to work? What do I do so that the session created in one browser can also be seen in another browser?

I've already auto-started session on every page using php.ini. If you need more details then please tell me, thanks.


Short answer: You cannot do that

Long answer: you have already answered to yourself by saying "I believe that sessions are stored in the server and cookies are stored in the browser"


Different browsers don't share cookie information, so you would need to start a new session in each browser.

What are you trying to accomplish?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜