how to count total visitors in a webpage after every refresh in the page?
It depends on your preference. You can either write it to a txt file or update the count in the database.
Basically you have a default count of 0 in either a txt file or database and increment it by 1 each time the page is loaded.
There are more advanced things you can do though such as limiting the increment by referrer ID, date etc or even count uniques vs returns.
Again, it depends on preference and exactly what you’re looking for but for the 2 I mentioned, you’ll need to look at:
Database: Select & Update
Txt File: fopen, fwrite, fclose