(Yaf >=1.0.0)
Yaf_Dispatcher::autoRender — 开启/关闭自动渲染
flag
bool
注意:
自 2.2.0 起。如果没有指定此参数,则会返回当前状态
示例 #1 Yaf_Dispatcher::autoRender() 示例
<?php
class IndexController extends Yaf_Controller_Abstract {
/* init method will be called as soon as a controller is initialized */
public function init() {
if ($this->getRequest()->isXmlHttpRequest()) {
//do not call render for ajax request
//we will outpu a json string
Yaf_Dispatcher::getInstance()->autoRender(FALSE);
}
}
}
?>
以上示例的输出类似于: