CakePHP 网站不显示更改,除非清除历史记录

CakePHP website not shows changes, unless clear the history

我的网站在 cakephp 中,每当我进行一些开发或更新我的网站 javascript 和 css 文件时。这些更改不会显示在我的用户端,除非他们清除浏览器的历史记录。无论如何,这样更改会自动显示。谢谢

最简单的方法是:

-> Add "version" in included css and js file path and update while modify

示例:

转到路径:project/src/Template/Layout

<?php echo $this->Html->css('toastr.min.css?ver=1.0'); ?>

CakePHP 支持开箱即用的资产时间戳,请参阅 Asset.timestamp 配置选项,以及 CakePHP 3.6+ URL 帮助程序中的 timestamp 选项。

启用时间戳后,最后一次修改的时间戳将添加到资产 URL,从而破坏缓存。

另见