Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $percorso = "./contatore.txt";
- $file = fopen($percorso, "r+");
- if($file == null){
- touch($percorso);
- $file = fopen($percorso, "r+");
- fwrite($file, "1");
- }
- else{
- $contatore = intval(file_get_contents($percorso)); //converto in int il contenuto del file
- $contatore += 1;
- fwrite($file, $contatore);
- fclose($file);
- }
- echo("<h1> Views: " . file_get_contents($percorso) . "<h1>")
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement