In recent days, when looking at the PHP Chinese manual, I saw the example of using PHP to make a chat room, so a whim also used PHP to write a simple web chat room application, in the process of writing chat room, I encountered the problem is not a lot, because the principle of using PHP to make a chat room is very simple, Perhaps this is related to my own way of thinking, I often like to make any seemingly complex things simple, I believe that the surface of complex things, in fact, contains a simple principle, my this mode of thinking in the web chat application of the production played a role, Below I will make the PHP web chat room principle to give you a description:
First we want to create a web framework, which is to use the HTML frame tag, the page containing the character to send the form and display the character of the page frame together, after we send the chat content, the content is saved to the new text file, The page that displays the characters is then refreshed in a short time every 3 seconds or 5 seconds. This allows us to implement our web chat application.
schematic diagram of simple chat room implementation
Finally I want to say is that any software development principle implementation is actually very simple, if you want to create a real finished software, then still need to constantly in this principle to improve.