<?php
//session_start();
$dir = 'cookie.txt';
$file = fopen($dir,'r');
$content = fgets($file);
fclose($file);
//if(empty($_SESSION['viewer'])){
$content++;
$newopen = fopen($dir,'w');
fwrite($newopen,$content);
fclose($newopen);
//$_SESSION['viewer'] = 1;
//}
//echo "网站的访问次数:{$content}";
$new = strval($content); //转化为字符串
$len = strlen($new);
$str = str_repeat('0',6-$len);
for($i=0;$i<strlen($str);$i++){
$result = $str[$i];
$result = '<img src="images/0.png" alt="" />';
echo $result;
}
for($j=0;$j<$len;$j++){
$result = $new[$j];
switch($result){
case 0 :
$ret[$j]='images/0.png';
break;
case 1 :
$ret[$j]='images/1.png';
break;
case 2 :
$ret[$j]='images/2.png';
break;
case 3 :
$ret[$j]='images/3.png';
break;
case 4 :
$ret[$j]='images/4.png';
break;
case 5 :
$ret[$j]='images/5.png';
break;
case 6 :
$ret[$j]='images/6.png';
break;
case 7 :
$ret[$j]='images/7.png';
break;
case 8 :
$ret[$j]='images/8.png';
break;
case 9 :
$ret[$j]='images/9.png';
break;
} //by www.jb200.com
echo '<img src="'.$ret[$j].'" alt="" />';
}
?>