dimanche 8 octobre 2017

mt_rand and rand not changing on page reload

I am having an odd issue with PHP. Here's my code:

<?php $rand = mt_rand(0,99);?>
<!doctype html5>
<html>
<head>
<title>MCAP</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div style="width:<?php echo $rand;?>%;background:blue no-repeat left center;background-size:100% 100%;height:100%;"><?php echo $rand;?>%</div>
</body>
</html>

The issue I'm facing is that the page will not update the number when I refresh it.

The site: http://ift.tt/2gnBGax

It will show a random number when I initially load the page, and when I refresh it once, but refreshing the page any more makes no difference. I am using an iPhone SE on Safari on iOS 11.0.2, in case that matters.

EDIT: It seems like a cache issue, but I'm not sure.




Aucun commentaire:

Enregistrer un commentaire