本文整理匯總了PHP中Model\User::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::getInstance方法的具體用法?PHP User::getInstance怎麽用?PHP User::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Model\User
的用法示例。
在下文中一共展示了User::getInstance方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Lockscreen
public function Lockscreen()
{
global $user;
if (isset($_POST['email']) && isset($_POST['passwd'])) {
$result = array("status" => 0, "message" => "驗證失敗");
$passwd = htmlspecialchars($_POST['passwd']);
$result['passwd'] = $passwd;
$user = User::getInstance();
$user = $user->GetUserByEmail($user->email);
$result['obj'] = $user;
if ($user->verifyPassword($passwd)) {
Util::setToken();
$result['status'] = 1;
$result['message'] = "驗證成功, 將跳轉到 >> 儀表盤";
} else {
$result['message'] = "我跟你講, 你密碼錯的在試2遍就給你鎖了.";
}
echo json_encode($result);
exit;
} else {
if (!\Helper\Listener::checkLogin()) {
\Core\Response::redirect('/Auth/login');
exit;
}
include Template::load('/panel/lockscreen');
}
exit;
}
示例2: __construct
public function __construct()
{
global $user;
$user = User::getInstance();
if (!$user->uid || !\Model\UserPower::verifyPower($user->uid)) {
Response::redirect('/Auth/login');
}
$user = $user->GetUserByEmail($user->email);
}
示例3: checkLogin
public static function checkLogin()
{
global $user;
$user = User::getInstance();
if (!$user->uid) {
return false;
}
return true;
}