现在的SESSION(新版本)不是这样用的了.
在使用前,请仔细查看手册(尤其是在线手册)
http://cn.php.net/manual/zh/ref.session.php
t1.php
session_start();
setcookie("PHPSESSID",session_id());$_SESSION["superlogin"]=true;
//session_register("superlogin");
t2.php
session_start();
if(!$_SESSION['superlogin']){
die("Please <a href='t_login.php'>login</a> ...");
}
SESSION 在PHP里,一般表现为数组.
所以,要比较扎实地使用.请熟练使用数组...
在使用前,请仔细查看手册(尤其是在线手册)
http://cn.php.net/manual/zh/ref.session.php
t1.php
session_start();
setcookie("PHPSESSID",session_id());$_SESSION["superlogin"]=true;
//session_register("superlogin");
t2.php
session_start();
if(!$_SESSION['superlogin']){
die("Please <a href='t_login.php'>login</a> ...");
}
SESSION 在PHP里,一般表现为数组.
所以,要比较扎实地使用.请熟练使用数组...
->
$_SESSION["aaa"]="value";
$_SESSION['varName'] = 'varValue';即可以注册一个SESSION变量你的那种方法其实也可以实现, 参看php.ini中的如下部分; This directive describes the order in which PHP registers GET, POST, Cookie,
; Environment and Built-in variables (G, P, C, E & S respectively, often
; referred to as EGPCS or GPC). Registration is done from left to right, newer
; values override older values.
variables_order = "GPCS"; Whether or not to register the EGPCS variables as global variables. You may
; want to turn this off if you don't want to clutter your scripts' global scope
; with user data. This makes most sense when coupled with track_vars - in which
; case you can access all of the GPC variables through the $HTTP_*_VARS[],
; variables.
;
; You should do your best to write your scripts so that they do not require
; register_globals to be on; Using form variables as globals can easily lead
; to possible security problems, if the code is not very well thought of.
register_globals = Off把 register_globals = Off 改为 register_globals = On 重起Apache 就OK !
请问你的
setcookie("PHPSESSID",session_id());
是做什么的 谢了