Yii2资产包时间戳始终不断更新

时间:2017-07-24 10:03:12

标签: yii2 timestamp assets bundles

我的Yii2资产包时间戳始终在每次重页加载时保持更新。

//配置:

'assetManager' => [
        'appendTimestamp' => true,
        'linkAssets' => getenv('LINK_ASSETS'),
        'class' => 'yii\web\AssetManager',
        'bundles' => [
            'yii\web\JqueryAsset' => [
                'js'=>[]
            ],
            'yii\bootstrap\BootstrapAsset' => [
                'css' => []
            ],
            'yii\bootstrap\BootstrapPluginAsset' => [
                'js' => []
            ]
        ],
    ],

<script src="/assets/e61789e4/yii.js?v=1500890158"></script>
<script src="/assets/e0852aa8/jquery.inputmask.bundle.js?v=1500890158"></script>
On page reload:
<script src="/assets/e61789e4/yii.js?v=1500890675"></script>
<script src="/assets/e0852aa8/jquery.inputmask.bundle.js?v=1500890676"></script>

如何让它们保持静止?抱歉我的英文。

1 个答案:

答案 0 :(得分:0)

'appendTimestamp'设置为false,它不会在链接文件末尾添加时间戳:

'assetManager' => [
        'appendTimestamp' => false,    // here's the magic
        'linkAssets' => getenv('LINK_ASSETS'),
        'class' => 'yii\web\AssetManager',