ava*_*sin 7 php layout controller xmlhttprequest phalcon
如何禁用布局渲染?
有一会儿,我可以通过jQuery检测到这个请求:
public function initialize()
{
if (!$this->request->isAjax()) {
// disable layout here... how?
}
}
Run Code Online (Sandbox Code Playgroud)
可以在全球范围内完成吗?
处理ajax请求的代码对于所有控件都是相同的,有没有办法为整个应用程序全局定义此行为规则?
Nik*_*los 17
public function initialize()
{
if (!$this->request->isAjax())
{
// disable layout here... how?
$this->view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_ACTION_VIEW);
}
}
Run Code Online (Sandbox Code Playgroud)
您也可以通过调用禁用自动渲染
$this->view->disable();
Run Code Online (Sandbox Code Playgroud)