在php5.3中运行书中代码会有如下提示:
Function session_is_registered() is deprecated in
Function session_register() is deprecated in
意思是说这两个函数是不赞成的,弃用的。<?php
// Use of session_register() is deprecated 不赞成用session_register()
$barney = "A big purple dinosaur.";
session_register("barney");
// Use of $_SESSION is preferred, as of PHP 4.1.0 首选 $_SESSION
$_SESSION["zim"] = "An invader from another planet.";
// The old way was to use $HTTP_SESSION_VARS
$HTTP_SESSION_VARS["spongebob"] = "He's got square pants.";
?>
WarningThis function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0. 警告:这个函数在php5.3中已不推荐使用,在php5.4中已被移除。
Note:
If $_SESSION (or $HTTP_SESSION_VARS for PHP 4.0.6 or less) is used, use isset() to check a variable is registered in $_SESSION.
提示:如果 使用了$_SESSION,就用isset()函数来检查。
Caution
If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered() and session_unregister().
|