聊天室实施

发布于 2024-09-12 06:41:17 字数 1435 浏览 8 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

戏舞 2024-09-19 06:41:17

您可能会想要使用 AJAX,或者如果不是的话,也可以使用带有计时器的 Javascript 来使聊天显得即时或进行轮询更新。

  1. (获取并显示聊天文本数据。) 表单前端字段接受聊天输入
  2. 通过表单发送到服务器的聊天输入。 AJAX 等待接收数据来更新聊天文本显示。
  3. 服务器更新数据队列(示例 - PHP 转储到 MySQL)。通过 AJAX 包装器发送回前端的数据
  4. 重复

有很多关于创建类似内容的教程 - 包括使用 AJAX i/o 的数字 - http://css-tricks.com/chat2/

You will probably want to use AJAX or if not that, Javascript with timer to make chat appear instant or with polled updates.

  1. (Chat text data fetched and displayed.) Form frontend fields accepts chat input
  2. Chat input sent to server via form. AJAX waits to receive data to update chat text display.
  3. Server updates a data queue (example - PHP dumps to MySQL). Data sent back to frontend via AJAX wrappers
  4. Repeat

There are lots of tutorials on creating something like this - including a number with AJAX i/o - http://css-tricks.com/chat2/

So尛奶瓶 2024-09-19 06:41:17

使用 php 和 mysql 可以做的最好的事情就是创建一个公告板类型的系统,人们可以在其中向“频道”添加评论,然后重新加载页面进行更新。

The best you can do with php and mysql is create a bulletin board kind of system where people add comments to a "channel", then reload the page to update.

甜味拾荒者 2024-09-19 06:41:17

总的来说,我认为,在此类项目中使用 PHP 是一个坏主意。每个客户都必须每隔几秒钟重新加载页面(例如提到的公告板)以获取更新信息。

In general, I think, it is a bad idea to use PHP for this kind of project. Every client hast to reload the page (mentioned bulletin board e. g.) every few seconds to get informed about updates.

稀香 2024-09-19 06:41:17

如果您想使用 PHP 和一点 JavaScript 进行编码,请尝试 Jaxl 库 Web 聊天示例应用程序。可以致力于构建一个成熟的聊天系统。 http://github.com/abhinavsingh/JAXL。当谈到聊天客户端时,XMPP 协议就是当今的方式:D

If you want to code in PHP and a little javascript, try Jaxl library Web Chat sample application. Can be worked upon to build a full fledged chat systems. http://github.com/abhinavsingh/JAXL. XMPP protocol is the way today, when it comes to chat client :D

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文