After changing the Php environment today, we found that the error message "Deprecated: Function session_register () is deprecated" is displayed. I will introduce it to you.
Let's first look at the code
The Code is as follows: |
Copy code |
<? Php // 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
The Code is as follows: |
Copy code |
Session_register ("abc "); Change $ _ SESSION ['abc'] = null; |
You can.
Summary
From the above process, we can see that this function has been deleted in PHP5.3. That is, this function is no longer available. You can simply use the following method.