0
我创建了一个自定义模块'sample'。我创建了'user_login'钩子。我想在user_login钩子内调用一个函数'calltype',但函数没有被调用.Cookie被创建If我写的CALLTYPE功能代码USER_LOGIN钩在钩子中调用一个函数
function sample_user_login(&$edit, $account){
$anivpopup = '1';
callType();
}
function callType(){
$anivpopup =1;
if($anivpopup == '1'){
setcookie('test', '2', time()+3600); //cookie set for 1 hr
}
}
?你为什么不把'$ anivpopup'发送到函数'callType()'? – 2pha
[参考:什么是变量作用域,哪些变量可以从哪里访问,什么是“未定义变量”错误?](https://stackoverflow.com/questions/16959576/reference-what-is-variable-scope -which-variables-are-accessible-from-where-and) – 2pha
noo需要传递value.check我更新后的post.just给出一个示例代码 – user3386779