【发布时间】:2014-06-08 22:06:22
【问题描述】:
大家早上好,我尝试使用zend框架查询以下表单但我不能,我想使用while,因为foreach已经这样做了,留下我的代码看看我错在哪里:
模型.php
<?php
class Application_Model_Datas
{
public function listar()
{
$db = Zend_Db_Table::getDefaultAdapter();
$select = $db->select()
->from('album');
return $db->fetchAll($select);
}
}
索引.phtml
<?php
//And your view looks like this.
while ($select = $this->datos){
print_r($results);
}
?>
控制器.php
<?php
class IndexController extends Zend_Controller_Action
{
public function init()
{
/* Initialize action controller here */
}
public function indexAction()
{
$table = new Application_Model_Datas();
$this->view->datos = $table->listar();
}
}
问题是它没有显示任何错误或数据或任何东西
【问题讨论】:
标签: php zend-framework while-loop