【发布时间】:2014-11-27 10:56:02
【问题描述】:
我是 Zend Framework 的新手,我创建了 DbTable ,我的主键是 id ,我的表名是 user:
<?php
class Application_Model_DbTable_User extends Zend_Db_Table_Abstract
{
protected $_name = 'user';
protected $_primary = 'id';
}
之后,我查看了Abstract.php(Db/Table/Abstract.php),发现我必须使用insert(array $data),所以我创建了一个模型:(Register.php)
<?php
class Application_Model_Register
{
public function CreateUser($array)
{
$dbTableUser = new Application_Model_DbTable_User();
$dbTableUser -> insert($array);
}
}
最后,在我的控制器中,我创建了 IndexController.php
<?php
class IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$register = new Application_Model_Register();
$register-> CreateUser(array(
'username'=>'test'));
}
}
它工作正常,但我不知道选择,我如何从用户表中选择查询?
【问题讨论】:
标签: mysql select zend-framework