作者alpe (薛丁格的猫-out)
看板PHP
标题Re: [请益] session无法在网页间传递
时间Tue Sep 19 09:11:51 2006
※ 引述《drlai (苏打)》之铭言:
: 标题: Re: [请益] session无法在网页间传递
: 时间: Tue Sep 19 02:14:50 2006
:
: ※ 引述《uest (uest)》之铭言:
: : session_start();
: : session_register('s1');
: ^^^^^^^^^^^^^^^^^^^^^^这行应该不需要
register_globals = off && php ver > 4.1 不需要
: : $_SESSION[s1] = "stamp";
: try $_SESSION['s1'] ?
$_SESSION['s1'] or $_SESSION["s1"]
原po这样写... ... 会warn吧
: : 然後在b.php要把他echo出来:
: : session_start();
: : echo $_SESSION[s1];
: : 结果是没有任何东西!
: : 可是如果我是在a.php存入session再读出来的话
: : 却可以印出session的值
: : 请问有人知道为什麽我的session不能在页面间传递吗?
: : 是不是php的设定哪里出了问题?
echo session_id(); in b.php & a.php
看完下面,你可以在猜猜看要不要 ... ...
: 推 pttkazu:大哥 要注册吧!!用isset看看 09/19 02:50
php.net =>
If you are using $_SESSION (or $HTTP_SESSION_VARS), do not
use session_register(), session_is_registered(), and session_unregister().
If session_start() was not called before this
function is called, an implicit call to session_start()
with no parameters will be made.
$_SESSION does not mimic this behavior and
requires session_start() before use.
You can also create a session variable by
simply setting the appropriate member of the
$_SESSION or $HTTP_SESSION_VARS (PHP < 4.1.0) array.
http://tw.php.net/manual/en/function.session-register.php
--
Live Long and Prosper
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 202.132.72.186
1F:推 appleboy46:这个问题 在此版 已经问过n次 09/19 09:46
2F:推 alpe:╮(﹀_﹀")╭ 09/19 10:35
3F:推 alpe:今天心情好肯回... ... XD 09/19 13:56
4F:推 pttkazu:多谢指教。 09/19 20:01