这是我的EVENT_DISPATCH:
public function preDispatch(MvcEvent $e) {
$controller = $e->getTarget(); // The controller which is dispatched
$request = $e->getRequest();
$viewModel = $e->getViewModel();
//$viewModel->
if ($request->isXmlHttpRequest()) {
$vars = $viewModel->getVariables();
$vars['headers'] = $controller->layout();
$view = new \Zend\View\Model\JsonModel($vars);
$e->setViewModel($view);
} else {
$controller->layout('ecik-light/layout');
}
}
我想将控制器视图(没有布局)渲染到$ var ['html']并获取所有标题(带标题位置)。
我该怎么做?
答案 0 :(得分:0)
使用回复
$e->getResponse()->getHeaders()