cakephp 从另外一个页面读取数据

$comments = $this->requestAction('/comments/latest');
foreach ($comments as $comment) {
    echo $comment['Comment']['title'];
}
echo $this->requestAction(
    array('controller' => 'articles', 'action' => 'featured'),
    array('return')
);

这种方式,可以直接返回一个变量或者对象,也可以返回一个html渲染的结果用于现实在页面上

posted @ 2013-05-07 11:40  linksgo2011  阅读(117)  评论(0)    收藏  举报