php简单的在线聊天室程序
php教程简单的在线聊天室程序
index.php
<title> 在线聊天 </title> <!-- 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>
_a.php
class="brush: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>  s教程ays 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
class="brush: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>
永久链接:
转载随意!带上文章地址吧。

핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

메모장++7.3.1
사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전
중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기
강력한 PHP 통합 개발 환경

드림위버 CS6
시각적 웹 개발 도구

SublimeText3 Mac 버전
신 수준의 코드 편집 소프트웨어(SublimeText3)

뜨거운 주제









PHPWarning:fopen():failedtoopenstream:Nosuchfileordirectory 해결 방법 PHP 개발을 사용하는 과정에서 "PHPWarning:fopen():failedtoopenstream:Nosuchfileordirectory"와 같은 파일 작업 문제가 종종 발생합니다.

PHPWarning:fopen():SSLOperationfailedinfile.phponlineX 해결 방법 PHP 프로그래밍에서는 fopen 함수를 사용하여 파일이나 URL을 열고 관련 작업을 수행하는 경우가 많습니다. 그러나 fopen 함수를 사용할 때 때때로 Warning:fopen():SSLOperationfailedinfile.p와 유사한 문제가 발생할 수 있습니다.

PHPWarning:fopen():failedtoopenstream:Permissiondenied 문제 해결 방법 PHP 프로그램을 개발하는 과정에서 PHPWarning:fopen():failedtoopenstream:Permissiondenied와 같은 오류 메시지를 자주 접하게 됩니다. 이 오류는 일반적으로 잘못된 파일 또는 디렉터리 권한으로 인해 발생합니다.

Matlab에서 fopen 함수는 파일을 열고 파일에 대한 후속 읽기 또는 쓰기 작업을 위해 파일 식별자를 반환하는 데 사용됩니다. 필요에 따라 적절한 권한 옵션을 선택하여 파일을 열고 작업이 완료되면 즉시 파일을 닫습니다. 파일을 연 후에는 시스템 리소스를 해제하는 데 더 이상 필요하지 않은 시간에 파일이 닫히는지 확인해야 합니다. 또한 파일 열기에 실패하거나 작업 오류가 발생하는 경우 오류 처리 메커니즘을 사용하여 그에 따라 처리할 수 있습니다.

PHP 개발에서는 파일 작업이 매우 일반적입니다. 정상적인 상황에서는 파일 읽기, 쓰기, 삭제 및 기타 작업을 수행해야 합니다. 그 중 fopen 함수, fread 함수를 사용하여 파일을 읽을 수 있고, fopen 함수, fwrite 함수, fclose 함수를 사용하여 파일을 쓸 수 있습니다. 이 기사에서는 PHP가 fopen, fwrite 및 fclose를 사용하여 파일 작업을 수행하는 방법을 소개합니다. 1. fopen 함수 fopen 함수는 파일을 여는 데 사용됩니다. r은 다음과 같습니다.

C의 fopen() 메소드는 지정된 파일을 여는 데 사용됩니다. 문제 구문 FILE*fopen(filename,mode)을 이해하기 위해 예를 들어 보겠습니다. 다음은 fopen()을 사용하여 파일을 여는 데 유효한 모드입니다: 'r', 'w', 'a', 'r+', 'w+ ', 'a+'. 자세한 내용은 C 라이브러리 함수 fopen()을 참조하세요.

PHPWarning:fopen():failedtoopenstream:Nosuchfileordirectoryinfile.phponlineX를 해결하는 방법 PHP 프로그램을 개발하고 실행할 때 때때로 PHPWarning:fopen():failedtoopenstream:Nosuchfileor가 발생합니다.

읽기 전용 속성, 비활성화 및 읽기 쓰기 속성을 사용하여 텍스트 영역을 읽기 전용으로 설정할 수 있습니다. 자세한 소개: 1. 읽기 전용 속성, 읽기 전용 속성의 값은 읽기 전용입니다. 2. 비활성화된 속성, 비활성화된 속성의 값이 비활성화되어 있기 때문에 <textarea> 요소의 내용을 변경할 수 없습니다. <textarea> 요소의 내용은 변경 사항 등이 될 수 있습니다.
