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."  says that  
".$msg.""."n");
for ($i =0;$i<$tot;++$i){
if ($i>50) break;
fwrite($fp,$oldmsg[$i]);
}
}
?>
_b.php
复制代码 代码如下:
聊天室
以上就介绍了omegle聊天室 php写的简易聊天室代码,包括了omegle聊天室方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
Statement: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