本文整理匯總了PHP中CWebUser::getId方法的典型用法代碼示例。如果您正苦於以下問題:PHP CWebUser::getId方法的具體用法?PHP CWebUser::getId怎麽用?PHP CWebUser::getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CWebUser
的用法示例。
在下文中一共展示了CWebUser::getId方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getId
public function getId()
{
if ($this->hasState('id')) {
return $this->getState('id');
}
return parent::getId();
}
示例2: testLoginLogout
/**
* @runInSeparateProcess
* @outputBuffering enabled
* @dataProvider booleanProvider
*/
public function testLoginLogout($destroySession)
{
$identity = new CUserIdentity('testUser', 'testPassword');
$user = new CWebUser();
$user->init();
// be guest before login
$this->assertTrue($user->isGuest);
// do a login
$this->assertTrue($user->login($identity));
// don't be guest after login
$this->assertFalse($user->isGuest);
$this->assertEquals('testUser', $user->getId());
$this->assertEquals('testUser', $user->getName());
$user->logout($destroySession);
// be guest after logout
$this->assertNull($user->getId());
$this->assertEquals($user->guestName, $user->getName());
}
示例3: kannLoeschen
/**
* @param CWebUser $c
* @return bool
*/
public function kannLoeschen($c)
{
if ($this->getVeranstaltung()->isAdminCurUser()) {
return true;
}
if (!is_null($this->verfasserIn->auth) && $c->getId() == $this->verfasserIn->auth) {
return true;
}
return false;
}
示例4: getId
public function getId()
{
return !$this->isGuest ? parent::getId() : 0;
}