2013-07-26 27 views

回答

0

您可以基於Zend_Auth創建自己的Authentication類,方法是將其放置在本地庫的某個位置並覆蓋getIdentity(),例如,

class Local_Auth extends Zend_Auth{ 

    public function getIdentity() 
    { 
     $storage = $this->getStorage(); 

     if ($storage->isEmpty()) { 
      return null; 
     } 

     return $storage->read(); 
    } 
} 

然後,而不是你的身份驗證過程實例Zend_Auth的,你只是實例Local_Auth代替。

0
To Over Write getIdentity() in Authentication Class 

Use this Code, 
Include this, 

use Zend\Authentication, 
Zend\Authentication\Result, 
Zend\Authentication\AuthenticationService; 

Create Instance for Authentication 
$auth = new AuthenticationService(); 

*****To Overwrite getStorage() in getIdentity()***** 

$auth->getStorage()->write('Your Data');