亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

PHP計(jì)數(shù)器的實(shí)現(xiàn)代碼

 更新時(shí)間:2013年06月08日 11:14:28   作者:  
本篇文章是對(duì)PHP計(jì)數(shù)器的實(shí)現(xiàn)代碼進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下
復(fù)制代碼 代碼如下:

<?php
/*使用文本文件記錄數(shù)據(jù)的簡(jiǎn)單實(shí)現(xiàn)*/
$counter=1;
if(file_exists("mycounter.txt")){
$fp=fopen("mycounter.txt","r");
$counter=fgets($fp,9);
$counter++;
fclose($fp);
}
$fp=fopen("mycounter.txt","w");
fputs($fp,$counter);
fclose($fp);
echo "<h1>您是第".$counter."次訪問本頁(yè)面!<h1>";
?>

復(fù)制代碼 代碼如下:

<?php
//下面這個(gè)為使用基于數(shù)據(jù)庫(kù)的簡(jiǎn)單計(jì)數(shù)器,未添加其他防止一人重復(fù)刷新的方法。僅供參考。。
$conn=mysql_connect("localhost","root","abc");
$result=mysql_query("use db_counter");
$re=mysql_query("select * from tb_counter");
$result=mysql_fetch_row($re);
$counter=$result[0];
echo "您是第{$counter}位訪問者!";
$counter+=1;echo "<hr>{$counter}";
mysql_query("update tb_counter set counter=$counter");
mysql_close($conn);
?>

相關(guān)文章

最新評(píng)論