您好,欢迎访问一九零五行业门户网

PHP jquery ajax实现即时聊天功能

这是一个简单的利用jquery与php做的一个聊天室的源码,我们这里定时利用ajax读取数据库并进行刷新了,下面直接参上源码,实例代码如下:
//index.html 
无标题文档
发言

data.php
200, 'time' => gmdate(s) , 'chat' => $chat, ); echo json_encode($json); break; www . phprm . com case 'while': $oldsize = filesize($file); $newsize = filesize($file); while (true) { if ($oldsize != $newsize) { $chat = file_get_contents($file); $json = array( 'status' => 200, 'time' => gmdate(s) , 'chat' => $chat, ); echo json_encode($json); exit; } clearstatcache(); $newsize = filesize($file); usleep(10000); } break; }}
send. php
其它类似信息

推荐信息