通过session来储存
session_start();
$_SESSION['username'] = "userName";
?>
在其它页面直接取出就行了
session_start();
echo $_SESSION['username'];
?>
通过url传向其它页面传递参数
other.php?user=xxx
或在php重定向到其它页面时
$username = "xxx";
$home_url = 'logIn.php?user='.$username;
header('Location:'.$home_url);
其它页面用$_GET["user"]来接收
3.通过表单向其它页面传送参数
其它页面用$_POST["user"]来接收