session_register()出错的解决办法
错误提示:Warning: Unknown(): Your script possibly relies on a session side-effect which
existed until PHP 4.2.3. Please be advised that the session extension does not
consider global variables as a source of data, unless register_globals is
enabled. You can disable this functionality and this warning by setting
session.bug_compat_42 or session.bug_compat_warn to off, respectively. in Unknown on line 0
1、PHP4.2以上版本不需要用session_register()注册SESSION变量,直接用:
$_SESSION["string"]=“string";
赋值。
2、用$_SESSION["string"]获取变量值。
3、用$_SESSION["string"][$n]可传递SESSION数组。
两个测试页面:
//a.php
session_start();
echo $_SESSION["X"]++;
//b.php
session_start();
echo $_SESSION["X"];
运行a.php并不断刷新它,看看有什么结果
运行b.php看看能否在页面之间传送结果。
注意:a.php和b.php必须是同一个IE进程!
测试在register_globals = off下进行,一切正常。
session_register()出错的解决办法
最新推荐文章于 2019-03-01 16:23:29 发布