Zend_Db数据库知识
例子:
Model文件:
$this->fetchAll(“is_jian=1″,”id DESC”,0,2)->toArray();//根据is_jian=1,按id倒序排列取前2条记录当第一个参数为null时,则直接按id倒序排列ASC为正序。
路由文件:
$video=new Video();//实例化数据库类
$this->view->get2Video =$video->get2Video();//取到2条首页推荐的数据
index.phtml文件:
<?php foreach ($this->get2Video as $video): ?>
<?=$video['id']; ?>
<?=$video['name']; ?>
<? endforeach; ?>
(全文…)