成人国产在线小视频_日韩寡妇人妻调教在线播放_色成人www永久在线观看_2018国产精品久久_亚洲欧美高清在线30p_亚洲少妇综合一区_黄色在线播放国产_亚洲另类技巧小说校园_国产主播xx日韩_a级毛片在线免费

資訊專欄INFORMATION COLUMN

php使用文本統(tǒng)計訪問量的方法

2501207950 / 2192人閱讀

摘要:本文實例講述了使用文本統(tǒng)計訪問量的方法。分享給大家供大家參考,具體如下方法方法文件用法

本文實例講述了php使用文本統(tǒng)計訪問量的方法。分享給大家供大家參考,具體如下:
方法1:

$fp = fopen("counter.txt", "r+");
while(!flock($fp, LOCK_EX)) { // acquire an exclusive lock
? // waiting to lock the file
}
$counter = intval(fread($fp, filesize("counter.txt")));
$counter++;
ftruncate($fp, 0); ? // truncate file
fwrite($fp, $counter); // set your data
fflush($fp); ? ? ?// flush output before releasing the lock
flock($fp, LOCK_UN); ?// release the lock
fclose($fp);


方法2:

counter.php文件:
/* counter */
//opens countlog.txt to read the number of hits
$datei = fopen("countlog.txt","r");
$count = fgets($datei,1000);
fclose($datei);
$count=$count + 1 ;
echo "$count" ;
echo " hits" ;
echo "n" ;
// opens countlog.txt to change new hit number
$datei = fopen("countlog.txt","w");
fwrite($datei, $count);
fclose($datei);
?>


用法:


include("counter.php");
?>

?

文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。

轉(zhuǎn)載請注明本文地址:http://systransis.cn/yun/561.html

相關(guān)文章

  • 阿里巴巴java開發(fā)手冊學(xué)習(xí)記錄,php

    摘要:的類型均為類型,前者現(xiàn)在時表示主動創(chuàng)建,后者過去分詞表示被動更新。推薦單表行數(shù)超過萬行或者單表容量超過,才推薦進(jìn)行分庫分表。超過三個表禁止。防止因字段類型不同造成的隱式轉(zhuǎn)換,導(dǎo)致索引失效。說明會統(tǒng)計值為的行,而列名不會統(tǒng)計此列為值的行。 一.編程規(guī)約 (一)命名風(fēng)格 1.目錄使用小寫+下劃線 home,view,model,admin_view 2.類 UpperCamelCa...

    wangym 評論0 收藏0

發(fā)表評論

0條評論

最新活動
閱讀需要支付1元查看
<