How to disable render view in zend framework 2?

前端 未结 6 666
臣服心动
臣服心动 2021-01-30 09:39

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.

How to disable rendering v

6条回答
  •  我在风中等你
    2021-01-30 10:11

    If you're using JSON, then look at the view's JsonStrategy and return a JsonModel from you controller. See this article.

    Alternatively, you can return an Response from your controller and the whole view layer is skipped:

    public function testAction()
    {
        $response = $this->getResponse();
        $response->setStatusCode(200);
        $response->setContent('foo');
        return $response;
    }   
    

提交回复
热议问题