情况是这样的。
我在1.php里include(2.php);
在2.php里定义个doInit()函数:
function doInit() {
$UserID=$_SESSION['UserID'];
$UserName=$_SESSION['UserNmae'];
}
我在1.php里调用doInit()函数后,如何才能使用$UserID变量。
不要定义全局变量啊。因为很多页面都需要doInit()里的内容,所以我打算采用include的方式写在一个页面里。只要能实现这个功能的办法就可以。