您好,欢迎访问一九零五行业门户网

小白求指点:自定义函数内调用另外一个函数里的全局变量,该如何写

小白求指点:自定义函数内调用另外一个函数里的全局变量,该怎么写啊
member.inc.php:
function marrbase(){
if(isset($_cookie[uname]) && isset($_cookie[uid])){
global $mbase;
$mbase_data = mysql_query(select * from dh_member where `id`= . $_cookie[uid] . and `mck`=1);
if (!$mbase_data){die(mysql_error());exit();}
$mbase = mysql_fetch_array($mbase_data);
}
else{exit();}
}
我是这样写的:
require_once(member.inc.php);
function supp(){
marrbase();
echo $mbase[email]; exit();
}

输出为空,小白求大神指点一下这个该怎么写才规范正确啊..
------解决思路----------------------
function supp() {
  global $mbase;
  marrbase();
  echo $mbase[email]; exit();
}
其它类似信息

推荐信息