通过WHMCS开发tutorial,我成功创建了页面。
但在示例代码中:
if ($ca->isLoggedIn()) {
$clientName = Capsule::table('tblclients')
->where('id', '=', $ca->getUserID())->pluck('firstname');
// 'pluck' was renamed within WHMCS 7.0. Replace it with 'value' instead.
// ->where('id', '=', $ca->getUserID())->value('firstname');
$ca->assign('clientname', $clientName);
} else {
// User is not logged in
$ca->assign('clientname', 'Random User');
}
如果isLoggedIn
是false
,我想将URL重定向到登录页面,如何实现呢?
答案 0 :(得分:0)
看看在WHMCS https://developers.whmcs.com/advanced/creating-pages/中创建页面的文档
简单的答案是$ca->requireLogin();
,如果将其放入代码中,人们将无法在不登录的情况下访问该页面,并且如果他们未登录则将被重定向到登录页面。