【发布时间】:2020-09-25 10:43:40
【问题描述】:
在 TYPO3 v10 中,您不能再使用 $TSFE->pageNotFoundAndExit()。但是控制器动作中的$this->request在使用ErrorController PageNotFound方法时会出现异常。
【问题讨论】:
标签: typo3 typo3-10.x
在 TYPO3 v10 中,您不能再使用 $TSFE->pageNotFoundAndExit()。但是控制器动作中的$this->request在使用ErrorController PageNotFound方法时会出现异常。
【问题讨论】:
标签: typo3 typo3-10.x
$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);
【讨论】: