如何禁用渲染视图Zend框架2? [英] How to disable render view in zend framework 2?

查看:98
本文介绍了如何禁用渲染视图Zend框架2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用一些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:

    • 视图模型
    • 阵列

    那么假禁用的观点。

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

    • 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;
    }
    

  • 这篇关于如何禁用渲染视图Zend框架2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆