0

Im having this problem guys. In one part of my code I delete an element of the json file

[
    {somedata},
    {somedata},
    {somedata} // deleted
]

after deleted and fwrite or file_put_contents I redirect to another script In that script I get the file.json data, but it is like returning the file data cached with that element not deleted yet. only when I press f5 it returns the new data.json file with that item delete.

Anyone knows how can I fix this issue. Ideas.

regards.

Jose Faro
  • 356
  • 1
  • 3
  • 13

1 Answers1

0

You can try adding no-cache headers to the second script:

<?php

header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>

See How to prevent Browser cache for php site for more info

Community
  • 1
  • 1
Justin Killen
  • 728
  • 6
  • 19