-
- // Fix for removed Session functions
- function fix_session_register(){
- function session_register(){
- $args = func_get_args();
- foreach ($args as $key){
- $_SESSION [$key]=$GLOBALS[$key];
- }
- }
- function session_is_registered($key){
- return isset($_SESSION[$key]);
- }
- function session_unregister($key){
- unset($ _SESSION[$key]);
- }
- }
- if (!function_exists('session_register')) fix_session_register();
- ?>
-
Copy code
I found another method, just put:
session_register( “abc” );
Change to
$_SESSION['abc'] = null;
That’s it
Changes in session in php5.3 (bbs.it-home.org Script School)
When running the code in the book in php5.3, you will get the following prompt:
Function session_is_registered() is deprecated in
Function session_register() is deprecated in
That is to say, these two functions are deprecated and deprecated.
The following is the code from the official PHP manual. The comments section has stated that session_register() is deprecated.
-
- // Use of session_register() is deprecated
- $barney = "A big purple dinosaur.";
- session_register("barney");
- // Use of $_SESSION is preferred, as of PHP 4.1.0 "] = "He's got square pants.";
- ?>
-
-
-
- Copy the code
and there are the following warnings and tips:
Warning
This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.
Warning: This function is deprecated in php5.3 and has been removed in php5.4.
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.
Tips:
If $_SESSION is used, use the isset() function to check.
If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered() and session_unregister().
|