zf2 disable the view completely disable the layout within controller change view

To disable the view completely, from within a controller action, you should return a Response object:
 [php]
< ?php
namespace SomeModule\Controller;
use Zend\Mvc\Controller\ActionController,
    Zend\View\Model\ViewModel;

class SomeController extends ActionController
{
    public function someAction()
    {
        $response = $this->getResponse();
        $response->setStatusCode(200);
        $response->setContent("Hello World");
        return $response;
    }   
}
[/php]

disable the layout within controller
 [php]

$result = new ViewModel();
$result->setTerminal(true);
return $result;
[/php]

change view
[php]
function someAction()
{
$result = new ViewModel();
$result->setTemplate(‘somemodule/somecontroller/arbitraryscript’);
}
[/php]