session的问题

发表于:2007-05-25来源:作者:点击数: 标签:phpsession问题4.0.6version
1) PHP Version 4.0.6,register_globals = On; 2)page1. php 中: ? session_start(); session_register (test1); session_register (test2); $HTTP_SESSION_VARS[test1] = 1; $HTTP_SESSION_VARS[test2] = 2; echo A=.sizeof($HTTP_SESSION_VARS); echo
1)PHP Version 4.0.6,register_globals = On;

2)page1.php中:
<?
session_start();
session_register ("test1");
session_register ("test2");
$HTTP_SESSION_VARS["test1"] = "1";
$HTTP_SESSION_VARS["test2"] = "2";
echo "A=".sizeof($HTTP_SESSION_VARS);
echo "<html>\n";
echo "<body>\n";
echo "<form name=form_1 method=post action='page2.php'>\n";
echo "<input type=submit value='SUBMIT'>\n";
echo "</body>\n";
echo "</html>\n";
?>
输出显示A=2

3)page2.pho:
<?
session_start();
echo "A=".sizeof($HTTP_SESSION_VARS);
?>
从page1.php点SUBMIT后,显示A=0

4)请问这是为什么呢?

5)$_SESSION同样不起作用。

原文转自:http://www.ltesting.net