如何在ZF 2中的控制器中调用basePath助手.我必须重定向到我需要基本路径的特定URL.return $ 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);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9622 次 |
| 最近记录: |