TYPO3 - 在自己的扩展中停用 cHash - 8LTS

TYPO3 - Deactivating cHash in own extension - 8LTS

我正在尝试在我的扩展程序中停用 cHash ... show 操作的 link 如下所示:

/?tx_abc_abc[record]=1&tx_abc_abc[action]=show&tx_abc_abc[controller]=Abc&cHash=10c78febea3ae5dsdf535fb36ca6d08

在 ext_localconf.php 中,我尝试像这样停用 cHash:

ext_localconf.php

<?php
if (!defined('TYPO3_MODE')) {
    die('Access denied.');
}

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin(
    'Vendor.' . $_EXTKEY,
    'Abc',
    array(
        'Abc' => 'list,show',

    ),
    // non-cacheable actions
    array(
        'Abc' => 'list,show',

    )
);

$GLOBALS['TYPO3_CONF_VARS']['FE']['cacheHash']['excludedParameters'][] = 'tx_abc_abc[record],tx_abc_abc[action],tx_abc_abc[controller]';

虽然它不起作用。我错过了什么?

在模板中构建链接时,您需要停用 cHash。如果您使用的是 ViewHelper <f:link.action>,那么您需要设置属性 noCacheHash="1".

对于 TYPO3 9 和 10

All we need to do is configure the parameter from which you don't want your chash to be calculated

比如你的link是这样的

<f:link.action action="detail" 
        additionalParams="{
            tx_plugin_action:{
               param1:1, param2:2, param3: 3
            },
            param4: 4
        }">Link Text</f:link.action>

那么你必须排除Localconfiguration.php

中的所有参数
'FE' => [
    'cacheHash' => [
        'excludedParameters' => [
            'tx_plugin_action[param1]',
            'tx_plugin_action[param2]',
            'tx_plugin_action[param3]',
            'param4',
        ],
    ],
]

Additionally: Remember that if any of the parameter is not included here then it will calculate and generate chash

Note: Here We don't need to set noCacheHash="1" explicitely in viewhelper