How to detect a page refresh with PHP?

Must Read : How to detect a page refresh with PHP?

How to detect a page refresh with PHP?

Sometimes you want to detect if the page was refreshed using “F5” key, or right click and “Reload” or any other method available. Either way, this can be detected somehow from server side. In this snippet, I will show you how to do this with PHP.

Method one

Method two

You can do this also based on the session, but if you go away from the site and return later in the same browser, the counter will be the same since the session didn’t changed.

Anyway, thank you for reading this and I hope you found it interesting.

(Visited 272 times, 1 visits today)

Leave a Comment.