Php Zend中的authenticate()操作出现问题

Php Zend中的authenticate()操作出现问题,php,zend-framework,netbeans,Php,Zend Framework,Netbeans,我将Netbeans 8.0与Xampp 3.2.1一起使用,收到一条错误消息“应用程序错误”,我已经找到了问题所在,如您在代码段中所看到的: public function loginAction() { $users = new Application_Model_DbTable_User(); $form = new Application_Form_Login(); $this->view->form = $form; if ($this-&

我将Netbeans 8.0与Xampp 3.2.1一起使用,收到一条错误消息“应用程序错误”,我已经找到了问题所在,如您在代码段中所看到的:

public function loginAction() {

    $users = new Application_Model_DbTable_User();
    $form = new Application_Form_Login();
    $this->view->form = $form;
    if ($this->getRequest()->isPost()) {
        if ($form->isValid($_POST)) {
            $data = $form->getValues();
            $auth = Zend_Auth::getInstance();
            $authAdapter = new Zend_Auth_Adapter_DbTable($users->getAdapter(), 'users');
            $authAdapter->setIdentityColumn('username')->setCredential('password');
            $authAdapter->setIdentity($data['username'])->setCredential($data['password']);

            $result = $auth->authenticate($authAdapter); // <- The problem is here
            $dump = $result->getCode();
            var_dump($dump);
            die;

            if ($result->isValid()) {
                $storage = new Zend_Auth_Storage_Session();
                $storage->write($authAdapter->getResultRowObject());
                $this->_redirect('Authentification/login');
            } else {
                $this->view->errorMessage = "Invalid username or password!";
            }
        }
    }
}
公共函数登录(){
$users=新应用程序\模型\数据库\用户();
$form=新应用程序\表单\登录();
$this->view->form=$form;
如果($this->getRequest()->isPost()){
如果($form->isValid($\u POST)){
$data=$form->getValues();
$auth=Zend_auth::getInstance();
$authAdapter=new Zend_Auth_Adapter_DbTable($users->getAdapter(),'users');
$authAdapter->setIdentityColumn('username')->setCredential('password');
$authAdapter->setIdentity($data['username'])->setCredential($data['password']);
$result=$auth->authenticate($authAdapter);//getCode();
var_dump($dump);
死亡
如果($result->isValid()){
$storage=new Zend_Auth_storage_Session();
$storage->write($authAdapter->getResultRowObject());
$this->_重定向('authentication/login');
}否则{
$this->view->errorMessage=“无效的用户名或密码!”;
}
}
}
}

我是Zend的新手,不知道如何解决这个问题,有没有比
var\u dump
更好的解决方法?我已经尝试了xdebug,但无法使它在我的项目中工作。

首先,您必须通过config/application.ini打开显示错误

在[production]和[development:production]阶段,必须将这三条线的检查设置为1:

phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
因此,您可以获得有关异常或任何其他错误的正确错误消息