查看内容

文件计数据器澳门太阳集团2007手机版

  • 2020-04-30 06:47
  • 编程人生
  • Views

php 文件计数据器+mysql双保护,这是上次升级版了,上次流量大太经常出问题今天修改过来了.

?phprequire_once(../inc/connect.php);Class Sit_count{ public $FileName = 'count.txt'; function Count_add(){if(file_exists($this-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();?本站原创转载注明