我在Zend Framework 2中有一个重定向问题。 当用户输入像http // mysite.test/lorem这样的url时,他将被重定向到http // mysite。测试/新闻/浏览/ LOREM-存有。重定向到UI不起作用(zf2)
代码:
$redirecttable = $sm->get('Redirect\Model\RedirectTable');
$route = $redirecttable->getRedirectByRoute($this->params()->fromRoute('page'));
if($route) {
// $route->getToroute() returns "news/view/Lorem-Ipsum"
return $this->redirect()->toUrl($route->getToroute());
}
我在这里做一个愚蠢的错误?
不'toRoute()'需要在模型实例指定的路线:'$这个 - >重定向() - > toRoute('news',array('action'=>'view'));'? –