This article introduces how to use php to process a large amount of data. Each time a piece of data is processed, the current status of the client is returned, if you are interested in PHP processing database data and returning to the client and displaying the relevant knowledge of the current status, learn how php processes a large amount of data.
Similar to dedecms for generating static pages
Idea:
1. The client sends a request
2. The server receives the request and starts to count the data volume to be processed.
3. Sort the data to be processed according to certain rules and send them to the server processing end.
4. The server processing end processes the first data and sends the processing result to the client after some processing.
5. When the client receives the result, it automatically displays the result and sends it to the server.
6. The server receives the processing result and forwards it to the server processing end.
7. The processing end continues to process the results...
8. loop through steps 4-7 until the processing is completed
Experiment process:
1. create databases and tables
create databases handle;create table user(id int unsigned not null auto_increment primary key,name varchar(8),sex tinyint(1) default '1',score int not null,state tinyint(1));
2. Add data to the table (not for example)
3.create the index.html client, a. php server 1, B. php server 2
Index.html:
ClientStart request