php counter program
Dec 02, 2016 am 11:41 AM1) Text counter
<?php (as the current mainstream development language)
$countfile="/count.txt"; //Set the file to save the data
if (!file_exists($countfile)){// Determine whether the file exists
exec( "echo 0 > $countfile");
}
$fp = fopen($countfile,"rw");
$length=filesize($countfile);
$num = fgets($ fp,$length);
$num += 1;
exec( "rm -rf $countfile");
exec( "echo $num > $countfile");
print "Total visits:"."$ num"."person times"; //Show the number of visits
?>
2) Graphic counter
<?
$countfile="/count-num.txt"; //Set the file to save the data
if (!file_exists ($countfile)) //Determine whether the file exists
{exec( "echo 0 > $countfile");}
$fp = fopen($countfile,"rw");
$length=filesize($countfile);
$num = fgets($fp,$length);
$num += 1;
exec( "rm -rf $countfile");
exec( "echo $num > $countfile");
$len_str = strlen($num);
for($i=0;$i<$len_str;$i++){
$each_num = substr($num,$i,1);
$out_str = $out_str . "<img src="/edu/UploadPic/2008-2/200821518124312.gif"">";
}
print "Total visits:"."$out_str"."Persons"; //Display the number of visits
?>

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

How To Set Up Visual Studio Code (VS Code) for PHP Development
