English 中文(简体)
Zendlogin Problem
原标题:Zend Login Problem

我在Zend Framwork中是新的。 我撰写了一份记录:

public function authAction()
{
    $request = $this->getRequest();
    $registry = Zend_Registry::getInstance();
    $auth = Zend_Auth::getInstance();
    $DB = $registry[ rdvs ];
    $authAdapter = new Zend_Auth_Adapter_DbTable($DB);
    $authAdapter->setTableName( user )
                ->setIdentityColumn( user_name )
                ->setCredentialColumn( password );    

    // Set the input credential values
    $uname = $request->getParam( username );
    $paswd = $request->getParam( pwd );
    $authAdapter->setIdentity($uname);
    $authAdapter->setCredential(md5($paswd));

    // Perform the authentication query, saving the result
    $result = $auth->authenticate($authAdapter);

    if($result->isValid()){
      //print_r($result);   
      $data = $authAdapter->getResultRowObject(null, password );
      $auth->getStorage()->write($data);
      $this->_redirect( /service/ );
    iiielse{
      $this->_redirect( /index/ );
    iii

iii

When i rum my web app then its given Exception : Message: No database adapter present I don t understand where i difine database or phpmyadmin connection.

最佳回答

替换

$DB = $registry[ rdvs ];

iii

$DB = Zend_Db_Table::getDefaultAdapter();

我希望你在你的申请中安排了你的布局。 如果不是,

在您申请的[制作]部分附上以下内容。 因此,这些数值如用户名、密码、名词等。

resources.db.adapter = PDO_MYSQL
resources.db.isDefaultAdapter = true
resources.db.params.host = localhost
resources.db.params.username = root
resources.db.params.password = 
resources.db.params.dbname = myDbName
问题回答

登记处的标注中可能会有一点。 相反,你可以做的是,在你创建名为Zentd_Db_Table_Abstract:setDefaultAdapter($db)而不是把它列入登记册时。 如果一个数据库的调适者没有向它们明确提供,那么ZF的大多数组成部分将对此加以研究。





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签