Home  >  Article  >  Backend Development  >  Example of making a graphical counter with PHP_PHP tutorial

Example of making a graphical counter with PHP_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:05:01717browse

I have seen many such examples in Oso before. The method is complicated. Please see the following example to implement a graphical counter. Please use

//Text file to store the count
$count ="count.txt";
//The number of digits of the counter, if not filled in, the default is 6 digits
$wei="";
//URL path of the image
$tu=" http://127.0.0.1/tcount/images";
?>
if ($wei=="") { $wei=6; }
if (! file_exists($count)) { $fp=fopen($count,"w+"); fputs($fp,0,100); fclose($fp); }
if ($REMOTE_ADDR!=$ip) {
$fp=fopen($count,"r+");
$cc=fgets($fp,100);
$cc=trim($cc);
if ($cc==" ") { $cou=1; }
else { $cou=$cc+1; }
rewind($fp);
fputs($fp,$cou,100);
fclose ($fp);
                                                                             fgets($fp,100);
$cou=trim($cou);
fclose($fp);
$w=strlen($cou);
while($w<$ wei) {
$cou="0".$cou;
$w++;
                                                                             "document.write("

");n";
while($i<$www) {
$ym=substr($cou,$i,1);
echo "document.write("");n";
$i++;
}
?>



http://www.bkjia.com/PHPjc/315813.html

www.bkjia.com

true

TechArticleI have seen many such examples in Oso before. Each method is complicated. Please see the following example to implement a graphical counter. Please use script src=http://file address/script ? //Storage...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn