如何禁用渲染视图Zend框架2?视图、框架、Zend

2023-09-10 15:55:10 作者:時光吹老了少年的心

我想用一些Ajax,但我不知道如何使用功能相同的setNoRender()Zend框架2禁用对渲染视图。

I want to use some ajax, but I don't know how to use function as the same as setNoRender() in zend framework 2 to disable for render view.

如何禁用渲染视图中的Zend Framework 2?

How to disable rendering view in zend framework 2?

推荐答案

要禁用您的看法:

To disable your view :

public function myactionAction()
{
    // your code here ...
    return false;
}

返回false禁止视图,而不是布局!为什么?因为接受类型是:

"return false" disables the view and not the layout! why? because the accepted types are:

视图模型 阵列 空

那么假禁用的观点。

如何禁用PS 2接口

要禁用布局和视图,返回响应对象:

To disable layout and view, return a response object:

public function myactionAction()
{
    // your code here ...
    return $this->response;
}

要禁止布局:

To disable layout:

public function myactionAction()
{
    // your code here ...
    $view = new ViewModel();
    $view->setTerminal(true);
    return $view;
}