gpt4 book ai didi

php写的简易聊天室代码

转载 作者:qq735679552 更新时间:2022-09-29 22:32:09 26 4
gpt4 key购买 nike

CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.

这篇CFSDN的博客文章php写的简易聊天室代码由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.

index.php  。

复制代码代码如下

<html>  <head><Title>  在线聊天  </title></head>  <!-- frames -->  <frameset rows="70%,*" BORDER="0">  <frame name="top" src="_b.php" marginwidth="0" marginheight="0" scrolling="yes" FRAMEBORDER="NO" noresize>  <frame name="bottom" src="_a.php" marginwidth="0" marginheight="0" scrolling="no" frameborder="no" noresize>  </frameset>  <body>  </body>  </html>  。

_a.php  。

复制代码代码如下

<html>  <title>  聊天室  </title>  <body TOPMARGIN=0 LEFTMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 >  <?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,"<font color=\"blue\">".$person."</font> in <font color=\"red\">".$time."</font>  says that  <b>".$msg."</b><br>"."\n");  for ($i =0;$i<$tot;++$i){  if ($i>50) break;  fwrite($fp,$oldmsg[$i]);  }  }  ?>  <TABLE width="100%" border="0" cellspacing="0" cellpadding="0">  <tr align="left" bgcolor="#666666">  <td height="20">  </td></tr>  <tr bgcolor="#FFCC66">  <td width="1" height="4" ></td>  </tr>  </TABLE>  <table width="100%" border=0 cellspacing=0 cellpadding=0 bgcolor="#EFEFEF">  <tr bgcolor="#666666">  <td align="left">  <table width="100%" height="500" boder=0 cellspacing=0 cellpadding=0 bgcolor="#EFEFEF">  <tr align="left">  <td valign="top">  <font size="-1" color="#666666">  <table width = "100%" border = "0">  <tr>  <form action="_a.php" method = "post">  <td align="left">  <font size="-1">昵称:</font>  <input type="text" name="person" size="12" maxlength="80" value="<?php echo $person;?>">  <br>  <font size="-1"></font>  <textarea type="textarea" name="message" rows="9" cols="150" size = 100></textarea>  <input type="submit" value="发言">  </td>  </form>  </tr>  </table>  </font>  </td>  </tr>  </tr>  </table>  </td>  </tr>  </table>  </body>  </html>  。

_b.php  。

复制代码代码如下

<html>  <head>  <title>  聊天室  </title>  </head>  <META HTTP-EQUIV=Refresh CONTENT="5; URL=_b.php">  <body bgcolor="#EFEFEF">  <?php  $handle=fopen("msg.txt","r");  //$oldmsg = array();  while ($content = fgets($handle)){  //$oldmsg[] = $content;  //++$tot;  echo $content;  }  ?>  </body>  </html>  。


php写的简易聊天室代码

最后此篇关于php写的简易聊天室代码的文章就讲到这里了,如果你想了解更多关于php写的简易聊天室代码的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com