For example, ajax is triggered by an action on the front-end page, and the data is retrieved from the background, and then dynamically returned to the front-end. for example, you can modify html elements without any additional modification. in turn, some code is executed by the php backend. If the code is successful, the code of the front-end page will be dynamically modified to achieve no refreshing. Is this technology available? For example, ajax is triggered by an action on the front-end page, and the data is retrieved from the background, and then dynamically returned to the front-end. for example, you can modify html elements without any additional modification. in turn, some code is executed by the php backend. If the code is successful, the code of the front-end page will be dynamically modified to achieve no refreshing. Is this technology available?
Reply content:
For example, ajax is triggered by an action on the front-end page, and the data is retrieved from the background, and then dynamically returned to the front-end. for example, you can modify html elements without any additional modification. in turn, some code is executed by the php backend. If the code is successful, the code of the front-end page will be dynamically modified to achieve no refreshing. Is this technology available?
Websocket pushes data to the front end
Both comet and websocket can be used, but they all need to be connected by the client.
First, you need to understand that php is a language running on the server. It cannot actively execute and initiate requests because:
Php is a script language for Synchronous execution, which naturally cannot implement asynchronous callback.
The server does not know who to send it to. What is the target ip address? Target Port?
Even if the server knows who to send it to, it cannot cope with the problem when there are enough users.
Even if there are few users, the current http Protocol cannot implement this function. In the http protocol, the server cannot initiate a Protocol to the client, but can only change to another communication protocol.
Even if another communication protocol is changed, the client must open a port for the server to initiate a stronger request, which is almost impossible for security and convenience and standardization.
Even if all the above difficulties are overcome, the client will not become a substantiveServer
?