Zend Framework之Zend_Acl

Zend_Auth实现用户的登录验证.
if(strtolower($_SERVER['REQUEST_METHOD'])=='post')
{
        Zend_Loader::loadClass('Zend_Filter_StripTags');
        $filter=new Zend_Filter_StripTags();
        //表单的post值
         $username = $filter->filter($this->_request->getPost('username'));
         $password = $filter->filter($this->_request->getPost('pwd'));
         //$validcode = $filter->filter($this->_request->getPost('validcode'));//验证码
        if( !empty($username) )
        {
                $db = Zend_Registry::get('dbAdapter');
                $authAdapter = new Zend_Auth_Adapter_DbTable($db);
                $authAdapter->setTableName('m_user')//数据库表名
                                // 数据库表的列的名称,用来表示身份。身份列必须包含唯一的值,例如用户名或者e-mail地址。
                                ->setIdentityColumn('username')
                                //数据库表的列的名称,用来表示证书。在一个简单的身份和密码认证scheme下,证书的值对应为密码
                                ->setCredentialColumn('pwd')
                          

你可能感兴趣的:(Zend,Framework,PHP)