在 TYPO3 v10 中,您不能再使用 $TSFE->pageNotFoundAndExit() 了。但是$this->request
在使用 ErrorController PageNotFound 方法时,在控制器动作中会出现异常。
问问题
945 次
1 回答
3
$TSFE->pageNotFoundAndExit() will be removed in TYPO3 v10.0. Use TYPO3's ErrorController with Request/Response objects instead.
在您的控制器中,您必须使用$GLOBALS['TYPO3_REQUEST']
而不是$this->request
.
提示:通过使用ImmediateResponseException
进一步的操作将不会被调用。
示例方法:
$response = GeneralUtility::makeInstance(ErrorController::class)->pageNotFoundAction(
$GLOBALS['TYPO3_REQUEST'],
'your 404 message'
);
throw new ImmediateResponseException($response, 1591428020);
于 2020-06-06T07:29:00.173 回答