问题描述
嗨! 我是 WHMCS 开发的新手。
我需要检查帐户状态并根据数据库中的值重定向到插件模块中的特定页面。
我需要在所有 ClientAreaPage(s) 上发生这种情况
这是我的代码的样子
add_hook('ClientAreaPage',1,function($vars) {
try {
$days3ago = date('Y-m-d',strtotime("-3 days"));
$rt = Capsule::table("tblname")
->select('status')
->where('user_id','=',$_SESSION['uid'])
->whereDate('created_at','<=',$days3ago)
->first();
if($rt->status == 'status'){
header('Location: index.php?m=addonname');
exit;
} else{
header('Location: clientarea.php');
exit;
}
} catch(\Illuminate\Database\QueryException $ex){
echo $ex->getMessage();
}
});
这会导致重定向循环,我知道由于钩子的性质,页面会不断调用自己,但是有没有办法实现这一点?任何建议和帮助请
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)