Sti*_*igi 4 redirect typo3 extbase typo3-7.6.x
$GLOBALS['TSFE']->pageNotFoundAndExit('');
Run Code Online (Sandbox Code Playgroud)
目前使用,但我想重定向到页面ID.
使用该命令redirectToUri,我找不到解决方案,或者没有工作.
码:
/**
* initialize action show
* @return void
*/
public function initializeShowAction() {
if ($this->request->hasArgument('xxx')) {
if ( $xxx=$this->xxxRepository->findByUid(
intval($this->request->getArgument('xxx'))
) ) {
$this->request->setArgument('xxx',$xxx);
return;
}
}
$GLOBALS['TSFE']->pageNotFoundAndExit('');
}
Run Code Online (Sandbox Code Playgroud)
您可以在控制器中使用以下代码构建一个uri:
$uriBuilder = $this->uriBuilder;
$uri = $uriBuilder
->setTargetPageUid($pageUid)
->build();
$this->redirectToUri($uri, 0, 404);
Run Code Online (Sandbox Code Playgroud)
在您的控制器中,您可以使用以下之一:
# Internal redirect of request to another controller
$this->forward($actionName, $controllerName, $extensionName, array $arguments);
# External HTTP redirect to another controller
$this->redirect($actionName, $controllerName, $extensionName, array $arguments, $pageUid, $delay = 0, $statusCode = 303);
# Redirect to URI
$this->redirectToURI($uri, $delay=0, $statusCode=303);
# Send HTTP status code
$this->throwStatus($statusCode, $statusMessage, $content);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7519 次 |
| 最近记录: |