Yet Another Framework Yaf_Dispatcher::autoRender
(Yaf >=1.0.0)
Yaf_Dispatcher::autoRender — 자동 렌더링 켜기/끄기
설명
public Yaf_Dispatcher::autoRender(bool $flag
= ?): Yaf_Dispatcher
Yaf_Dispatcher는 들어오는 요청을 발송한 후 자동으로 렌더링됩니다. flag
true
로 이 메서드를 호출하여 렌더링을 방지할 수 있습니다.
메모: 해당 작업의 자동 렌더링을 방지하기 위해 작업에서 단순히 false
를 반환할 수 있습니다.
매개변수
flag
- bool
메모: 2.2.0부터 이 매개변수를 지정하지 않으면 현재 상태가 반환됩니다.
반환 값
Examples
예제 #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);
}
}
}
?>
위의 예는 다음과 유사한 결과를 출력합니다.