Home >Backend Development >PHP Tutorial >Deprecated: Function session_register() is deprecated solution_PHP tutorial

Deprecated: Function session_register() is deprecated solution_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 10:57:00978browse

After changing the Php environment today, we found that there was an error message Deprecated: Function session_register() is deprecated. Let me introduce it to my friends.

Let’s look at the code first

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();
?>

Copy code


代码如下 复制代码

session_register( “abc” ) ;

改成

$_SESSION['abc'] = null;

// 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]);

}

} ?> After checking there are not many places where this problem occurs, I found another method, just Put
The code is as follows Copy code
session_register( “abc” ) ; changed to
$_SESSION['abc'] = null; That’s it Summary From the above process, we have shown that this function has been deleted in PHP5.3 version. That is to say, this function is no longer available. You can just use the following method. http://www.bkjia.com/PHPjc/632134.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/632134.htmlTechArticleAfter changing the Php environment today, we found a Deprecated: Function session_register() is deprecated error message. Below I Let me introduce it to my friends. Let’s look at the code first. Code...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn