1
我想爲我的web應用程序創建用戶。使用sfDoctrineGuardPlugin進行常規會員登錄?
即時通訊使用symfony。我想知道是否應該用sfDoctrineGuardPlugin或symfony提供的方法來做到這一點?
// Add one or more credentials
$user->addCredential('foo');
$user->addCredentials('foo', 'bar');
// Check if the user has a credential
echo $user->hasCredential('foo'); => true
// Check if the user has both credentials
echo $user->hasCredential(array('foo', 'bar')); => true
// Check if the user has one of the credentials
echo $user->hasCredential(array('foo', 'bar'), false); => true
// Remove a credential
$user->removeCredential('foo');
echo $user->hasCredential('foo'); => false
// Remove all credentials (useful in the logout process)
$user->clearCredentials();
echo $user->hasCredential('bar'); => false
或者是sfDoctrineGuardPlugin的目的只是保護管理頁面而不是前端日誌記錄系統?
謝謝。
好吧......我以爲這只是後端。但它聽起來很可擴展。所以我可以添加額外的表格列? – 2010-05-18 17:58:43
是的,插件允許你指定一個「profile」表格,這個表格可以通過外鍵方便地從你的User對象中訪問,我記不得什麼,但是像$ user-> getProfile()這樣簡單。 – 2010-05-18 18:01:36
好極了!你知道sfDoctrineGuardPlugin和sfGuardPlugin有什麼不同嗎?我應該選擇哪一個? – 2010-05-18 18:07:08