开发者

session does not work with mod-rewrited urls?

I have this page www.exmaple.com/username which is rewritten url, but the sessions does not work there.

That is, when I echo, it does not show the value, but all the other pages that have not been re-written are wo开发者_如何学JAVArking!

<?php session_start();
echo $_SESSION['user_id'];

?>

Is there something that I'm missing?


Does this rewrite involve a change of domain or subdomain in the URL? Cookies are, by default, accessible only to the same subdomain they were set on... and session identifiers are maintained by cookies.


Sessions are not affected by mod_rewrite, but you need to prepend every page with session_start().


You must call session_start() to read the session or $_SESSION will not be populated.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜