最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
php简单的在线聊天室程序
时间:2011-06-02 编辑:简简单单 来源:一聚教程网
php教程简单的在线聊天室程序
index.php
在线聊天
_a.php
聊天室
$person = @$_POST[person];
$msg = @$_POST[message];
if ($person!="" && $msg!=""){
$handle = fopen("msg.txt","r");
$tot = 0;
$oldmsg = array();
while ($content = fgets($handle)){
$oldmsg[] = $content;
++$tot;
}
fclose($handle);
unlink("msg.txt");$fp = fopen("msg.txt","a+");
$time = date("h:i");
fwrite($fp,"".$person." in ".$time."  s教程ays that  ".$msg."
"."n");
for ($i =0;$i<$tot;++$i){
if ($i>50) break;
fwrite($fp,$oldmsg[$i]);
}
}?>
_b.php
聊天室
$handle=fopen("msg.txt","r");
//$oldmsg = array();
while ($content = fgets($handle)){
//$oldmsg[] = $content;
//++$tot;
echo $content;
}
?>
-
下一个: PHP中数据类型详解
相关文章
- 简单实用PHP日历程序代码 06-17
- php简单日历实现程序代码 10-14
- PHP实现简单计算器程序代码 09-17
- 一个简单php 抽奖小程序 01-06
- php简单的日历程序代码 11-20
- php简单的日历程序 09-18