如何在javascript中调用PHP标头刷新?

I have a PHP script that does not update the page with this code in JavaScript.

window.onpageshow = function(event) {
    if (event.persisted) {
        window.location.reload()    
    }
};

The same problem occurs with 534 different ways to reload a page with JavaScript.

example.php

<?php
header("Refresh:0");
?>

Any idea to let window.location.reload() call the file example.php?

Try this hack:

window.location.href=window.location.href

You can use this code to simulate HTTP redirect

window.location.replace("exemple.php");

Or this to simulate a click in a Link

window.location.href = "exemple.php";