ignore cache on certain page .php

-1

I have a php code where I get a link. This link expires about 10 times a day, my code checks if the link expires and after a new one.

//o arquivo é single.php wordpress
<video id="player" poster="<?php echo $thumb; ?>" controls style="width: 100%; height: 400px;">
<source src="<?php echo $mp4;?>" type="video/mp4" />
</video>

The variable that stores the url is $ mp4, it always has the correct link

So many people who visit the website appear the link expired, due to the cache.

How to do this page or code snippet does not cache anyway?

detail. I'm using a cache plugin for wordpress and cloudflare.

Embrace

    
asked by anonymous 06.08.2018 / 16:34

1 answer

-1

In a shortened version:

  

Using PHP:

header("Cache-Control: no-cache, no-store, must-revalidate"); // HTTP 1.1.
header("Pragma: no-cache"); // HTTP 1.0.
header("Expires: 0"); // Proxies.
  

Using HTML:

<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="0" />

This will tell the browser to always refresh the cache. Making it "never" have saved cache for the page.

Original answer at: link

    
06.08.2018 / 17:01