php图片计数器代码,他的实现方法是先用程序把数字保存到一个txt文件或数据库,然后再读取,当然数字我们要做0-9的图片啊.好了下面我们来看看统计代码吧.
filename) ){
$temp = file_get_contents($this->filename);
$array = explode(=,$temp);
if(count($array) != 2){
$tmp ='mytext='.$this->tcount();
}else{
$total = $array[1]+1;
$tmp =$array[0].'='.$total;
}
$t = @fopen($this->filename,'w');
if($t){
fwrite($t,$tmp);
fclose($t);
}
mysql_query(update wk_count set count_bak =count_bak+1 where id=1);
}else{
echo '! file_exists';
}
}
function tcount(){
$result =mysql_query(select * from wk_count where id =1 ) or die(mysql_error());
$rs =mysql_fetch_array($result);
return $rs['count_bak'];
}
}
$tp = new sit_count;
$tp->count_add();
?>
好了下面我们来看看show.php输出文件.
=0;$i--){
echodocument.write('');;
}
?>
这样我们的输片计数器就出来了,注意哦. echodocument.write('');; 必须以document.write输出哦,因为我们下面要用js形式调用哦.
下面在txt.html这样调用show.php文件就行了如下.
等吧,我们教程就ok了.
本站原创转请注明: www.111cn.net/phper/php.html