【问题标题】:Laravel / Centos 7: Do not update changes of js file when savedLaravel / Centos 7:保存时不更新 js 文件的更改
【发布时间】:2019-03-14 04:03:47
【问题描述】:

我正在尝试使用 CentosBox / Centos-7-v7.4-Web-Server-CLI-Apache2.4-PHP7 使用 laravel 开发一个网站。我有一个问题,就是当我更改了js文件的内容,但是刷新浏览器时,js文件中更改的内容没有更新。

我尝试运行: composer dump-autoload、php artisan config: clear、php artisan cache: clear、php artisan view: clear

但它不起作用。

期待大家的帮助!

【问题讨论】:

  • 也可以试试 php artisan config:cache
  • 你在终端运行npm install了吗?
  • 它发生在我身上很多次,仔细检查你是否更新了正确的 js 文件

标签: javascript php laravel centos7


【解决方案1】:

非常简单,只需在 js 文件后添加 ?v=1 或任意数字

例子

<script src="jquery.js?v=1"> </script>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-07-18
    • 2020-08-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-09
    • 1970-01-01
    相关资源
    最近更新 更多