我是MVC的新手,我需要在View中回显我数据库中的数据。任何人都可以帮助我吗?这是代码:
控制器:
class Index extends Controller {
function __construct() {
parent::__construct();
//echo 'We are in index';
}
function index(){
$this->view->render('index/index');
}
function get(){
$this->model->get();
}
}
型号:
class Index_Model extends Model {
public function __construct()
{
parent::__construct();
}
function get()
{
$sth = $this->db->prepare('SELECT * FROM data');
$sth->setFetchMode(PDO::);
$sth->execute();
$sth->fetchAll();
}
}
如何在View中回显?