我如何在 ZF 2 的控制器中调用 basePath 帮助程序。我必须重定向到我需要基本路径的特定 url。
返回 $this->redirect()->toUrl($basePath.'/application/rent/search');
这是一个简单的方法使所有视图助手在控制器中可用。所以你应该能够使用以下内容:
public function someAction()
{
$renderer = $this->serviceLocator->get('Zend\View\Renderer\RendererInterface');
$url = $renderer->basePath('/application/rent/search');
$redirect = $this->plugin('redirect');
return $redirect->toUrl($url);
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)