我有2个文件[a.php和b.php]
a.php代码
<?PHP
$msg= "Hello world";
session_register('msg');
header("Location: b.php ");
exit;
?>
和b.php代码
<?PHP echo $msg ; session_unregister('msg')?>
但是
php手册说“This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.
”
所以我可以做出任何改变,以便再次运作?
答案 0 :(得分:6)
<强> a.php只会强>
<?php
session_start();
$_SESSION['msg'] = 'Hello world';
header("Location: b.php ");
exit;
?>
<强> b.php 强>
<?php
session_start();
echo $_SESSION['msg'];
unset($_SESSION['msg']);
?>