使用php,JS强制浏览器在页面加载时使用最新的JS和CSS文件

I have developed some websites using custom PHP and YII2. Whenever I have modified any JS or CSS file, it doesn't give any effect on my web pages. To apply the newest version of my code, I have to press ctrl+f5 to refresh it.

I have already gone through the several answers, but no effect. I have checked the below links: Force browser to refresh css, javascript, etc
How can I force clients to refresh JavaScript files?

Please help me to solve this.

You can achieve this by setting AssetManager::$appendTimestamp to true. In your web config:

'assetManager' => [
    'appendTimestamp' => true,
]

Whether to append a timestamp to the URL of every published asset. When this is true, the URL of a published asset may look like /path/to/asset?v=timestamp, where timestamp is the last modification time of the published asset file. You normally would want to set this property to true when you have enabled HTTP caching for assets, because it allows you to bust caching when the assets are updated.