: This article describes how to actively send data to the client on the php Server. if you are interested in the PHP Tutorial, refer to it. 1. hide iframe on the client. its src points to the control code of the server, such as server. php.
2. in server. php, while is used to implement a request that never ends. in a loop, breakpoint is implemented, for example, sleep (2), indicating a loop every 2 seconds.
3. output the snippet code to the client in each loop
Echo "script" parent. $ ('# list'). append ('
Xxxxxxxxx') Script ";
Ob_flush ();
Flush ();
The server-side overall test code is implemented as follows:
$ I = 0; while ($ I <20) {echo 'script parent. $ (\ '. contentlist \'). append ("Xxxxxxxxxxxxx
"); Script '; ob_flush (); flush (); sleep (2); $ I ++ ;}
The above describes how to actively send data to the client on the php server, including some content, and hope to help those who are interested in the PHP Tutorial.