我有一个奇怪的问题。我试图通过创建一个ViewHelper来包含我的网站,该ViewHelper包含这段代码,但由于某些原因它不能按预期工作:
//....
$forward = $serviceManager->get('ControllerPluginManager')->get('Forward');
$view = $forward->dispatch('Application\Controller\Widgets', array('action' => 'notexistingaction'));
$view1 = $forward->dispatch('Application\Controller\Widgets', array('action' => 'existingaction'));
\Zend\Debug\Debug::dump($view);
\Zend\Debug\Debug::dump($view1);
//....
结果是
object(Zend\View\Model\ViewModel)#713 (7) {
["captureTo":protected] => string(7) "content"
["children":protected] => array(0) {
}
["options":protected] => array(0) {
}
["template":protected] => string(9) "error/404"
["terminate":protected] => bool(false)
["variables":protected] => array(4) {
["content"] => string(14) "Page not found"
["message"] => string(15) "Page not found."
["reason"] => string(32) "error-controller-cannot-dispatch"
["display_exceptions"] => bool(true)
}
["append":protected] => bool(false)
}
object(Zend\View\Model\ViewModel)#716 (7) {
["captureTo":protected] => string(7) "content"
["children":protected] => array(0) {
}
["options":protected] => array(0) {
}
["template":protected] => string(9) "error/404"
["terminate":protected] => bool(false)
["variables":protected] => object(Zend\View\Variables)#717 (2) {
["strictVars":protected] => bool(false)
["storage":"ArrayObject":private] => array(3) {
["message"] => string(15) "Page not found."
["reason"] => string(32) "error-controller-cannot-dispatch"
["display_exceptions"] => bool(true)
}
}
["append":protected] => bool(false)
}
问题为什么? 从技术上讲,应该有一个有错误,另一个要显示其内容..但由于某种原因,两者都显示为404
请帮忙吗?
由于