Php is upgraded from 5.2.x to 5.3.2. Some previously used programs reported an error. The problem occurred when Deprecated: Functionsession_register () isdeprecated php was upgraded from 5.2.x to 5.3.2. Some previously used programs report errors.
The error message is:
Deprecated: Function session_register () is deprecated
Check that session_register 5.3 is not used. how can it be downgraded? Unhappy.
I searched and found a solution: write a function.
The code is as follows:
// 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 ();
?>
I checked that there were not many issues. I found another method, directly
Set
Session_register ("abc ");
Change
$ _ SESSION ['ABC'] = null;
You can.
Session changes in php5.3
In php5.3, the following code prompts:
Function session_is_registered () is deprecated in
Function session_register () is deprecated in
This means that these two functions are not in favor and are discarded.
The following is the code in the php official Manual. the comments section shows that session_register () is not supported ()
The code is as follows:
// Use of session_register () is deprecated does not approve of session_register ()
$ Barney = "A big purple dinw.ur .";
Session_register ("barney ");
// Use of $ _ SESSION is preferred, as of PHP 4.1.0 preferred $ _ 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 .";
?>
The following warning and prompt are displayed:
Warning
This function has been DEPRECATED as of PHP 5.3.0 and REMOVED as of PHP 5.4.0.
Warning: This function is not recommended in php5.3 and has been removed from 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.
Tip: If $ _ SESSION is used, check using the isset () function.
Caution
If you are using $ _ SESSION (or $ HTTP_SESSION_VARS), do not use session_register (), session_is_registered () and session_unregister ().