Re: [問題] 有關計數器

看板Web_Design作者 (Taiwan Yes !)時間19年前 (2005/05/05 12:49), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
修改如下 in a.htm <?php include("count.php"); ?> in b.htm <?php include("countpic.php"); for ($array_id = 1;$array_id < $array_elements; ++ $array_id) { echo ("<img src=images/counter/$counter_array[$array_id].gif></img>"); } ?> count.php檔如下: <?php $countfile = "counter.dat"; if (($fp = fopen($countfile, "r+")) == false) { printf ("Open file %s failed!",$countfile); exit; } else { $count = fread ($fp,filesize($countfile)); $count = $count + 1; fclose ($fp); $fp = fopen($countfile, "w+"); fwrite ($fp,$count); fclose ($fp); } ?> countpic.php檔如下: <?php $countfile = "counter.dat"; $fp = fopen ($countfile, "r"); $array_count = 1; while (! feof($fp)) { $current_number = fgetc($fp); $counter_array[$array_count] = $current_number; $array_elements = count ($counter_array); $array_count = $array_count + 1; } ?> -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.113.151.64

140.122.140.202 05/05, , 1F
馬上用馬上可以 真是太感謝了!!!
140.122.140.202 05/05, 1F
文章代碼(AID): #12UQNHeJ (Web_Design)
文章代碼(AID): #12UQNHeJ (Web_Design)