在Cakephp2中的自定义身份验证中使用用户模型


Use a user model in a custom authentification in Cakephp 2

我在cakepp中使用一个自定义身份验证对象。

In AppController :
$this->Auth->authenticate = array('Ldap','Database');

我需要我的自定义身份验证组件来连接到数据库。我已经在Controller/Component/Auth/DatabaseAuthentification.php中创建了文件DatabaseAuthenticate在我的自定义对象中,我需要在数据库中请求一个表。我试过一些控制器以外的功能

public $uses =array('Car', 'Bike'); 

但是它不起作用,我不知道怎么做。

cakehp2?你可以试试:

$model = ClassRegistry::init('Yourmodel');

将您的模型简单查询到组件中

$result= $model->find('all');