namespace Foo\Controller; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; class BazBatController extends AbstractActionController { public function doSomethingCrazyAction() { $view = new ViewModel(array( 'message' => 'Hello world', )); // Disable layouts; `MvcEvent` will use this View Model instead $view->setTerminal(true); //加此代码 return $view; } }
zf2 禁用layout
最新推荐文章于 2018-08-16 19:43:08 发布