最简单的,一看就懂的那种;
count.php文件;
<?php
$fp=fopen('count.txt',"w");
$tmpcount=fread($fp,filesize('count.txt'));
$tmpcount++;
$fput=fput($fp,$tmpcount);echo '你是第 '.$tmpcount.'位';
?>
count.php文件;
<?php
$fp=fopen('count.txt',"w");
$tmpcount=fread($fp,filesize('count.txt'));
$tmpcount++;
$fput=fput($fp,$tmpcount);echo '你是第 '.$tmpcount.'位';
?>
解决方案 »
- php 利用404 这种方法生成伪静态,可取吗?
- 带"/"的查询怎么办?
- php源码大全 大家把手中的源码站点公布一下吧,以后也方便你找东西!
- 实现IP反查询的代码,请指教
- 想问下大家有关PHPCHINA那个PCTI的认证问题!
- PHP程序员
- 偶还没了.还是关于文本数据库查询的问题.
- PHP5中的__construct()和PHP4中的普通的构造函数有什么区别?
- 问一个关于时间比较的问题
- php getheaders的一点疑惑(curl也会有这个问题)
- 我下载的是phptriad v2.21版,apache,mysq都能打开,但phpmyadmin却打不开
- 为什么PHP编写的程序浏览后不能脱机浏览呢?
$memo_file="data.txt";
if ($phpxcount<>$REMOTE_ADDR){
$visits = file($memo_file);
$number_of_last_visit = $visits[0];
$number_of_new_visit = ++$number_of_last_visit;
$fp = fopen($memo_file, "w");
$fw = fwrite($fp, $number_of_new_visit);
fclose($fp); $len_str = strlen($number_of_new_visit);
for($i=(0);$i<$len_str;$i++){
$numbers_exploded = substr($number_of_new_visit,$i,1);
$output_str = $output_str . "<img src=\"$numbers_exploded.gif\">";
}
}else{
$visits = file($memo_file);
$number_of_last_visit = $visits[0];
$number_of_new_visit = $number_of_last_visit;
$fp = fopen($memo_file, "w");
$fw = fwrite($fp, $number_of_new_visit);
fclose($fp); $len_str = strlen($number_of_new_visit);
for($i=(0);$i<$len_str;$i++){
$numbers_exploded = substr($number_of_new_visit,$i,1);
$output_str = $output_str . "<img src=\"$numbers_exploded.gif\">";
}
}
echo $output_str;
?>
$memo_file="counter.txt"; /*save counternum in the boot/counter/counter.txt*/
$visits=file($memo_file); //get arry from the file
$num =$visits[0]; //get the content of the first line in the file
$num += 1;
exec("rm -rf $memo_file"); //rm old
exec("echo $num > $memo_file"); //create new
?>
document.write("<form name=counter><input type=text name=countshow size=16 style='font-size:9pt; color:#FFFF00; background-color:#000000; text-align:center; line-height:130%; border:3 ridge #00FF00' value=''></form>");
s=new Array(2);
s[0]="第 <?print($num)?> 次"
s[1]="中国计数器"
var id,p=0;
function show(){
document.counter.countshow.value=s[p];
p=p+1;
if(p>1){
p=0
}
id=setTimeout('show()',2000);
}
show();
<script language="javascript" src="count.php3"></script>