php简略计数器

WBOY
Release: 2016-06-13 13:13:45
Original
925 people have browsed it

php简单计数器

"; //2-------文本计数器 $file="../counter/count.dat"; if (!file_exists($file)) { $num_txt=1; }else { $num_txt=file_get_contents($file); $num_txt++; } $fp=fopen($file, "w"); fwrite($fp, $num_txt); fclose($fp); echo "You are the ".$num_txt." times visit."."
"; //3-------防刷新计数器 $file = "../counter/count.dat"; if (! file_exists ( $file )) { $fp = fopen ( $file, "w" ); fwrite ( $fp, "0" ); fclose ( $fp ); } $num_txt = file_get_contents ( $file ); session_get_cookie_params ( 24 * 3600 ); session_start (); if (! isset ( $_SESSION ["visited"] )) { $num_txt ++; $fp = fopen ( $file, "w" ); fwrite ( $fp, $num_txt ); fclose ( $fp ); $_SESSION ["visited"] = "true"; } echo "You are the " . $num_txt . " times visit." . "
"; //4--------图片计数器,同上,需要转杯0-9数字对应的图片 //5---------多用户计数器,存在数据库中 ?>
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!