2

在 TYPO3 v10 中,您不能再使用 $TSFE->pageNotFoundAndExit() 了。但是$this->request在使用 ErrorController PageNotFound 方法时,在控制器动作中会出现异常。

4

1 回答 1

3
$TSFE->pageNotFoundAndExit() will be removed in TYPO3 v10.0. Use TYPO3's ErrorController with Request/Response objects instead.

https://docs.typo3.org/c/typo3/cms-core/master/en-us/Changelog/9.2/Deprecation-83883-PageNotFoundAndErrorHandlingInFrontend.html

在您的控制器中,您必须使用$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 回答