这是我的 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'] 并获取所有标题(带有标题位置)。
我该怎么做?