Php does not want java to inherit the Thread interface directly or implement the Runnable interface for multi-Thread development. However, php provides a powerful curl tool that supports multithreading. You can use curl_multi_init () in php () to simulate parallel processing and multi-threaded program functions. You can also use curl_multi_init () to simulate multi-thread submission. As shown in the following program
Php does not want java to inherit the Thread interface directly or implement the Runnable interface for multi-Thread development. However, php provides a powerful curl tool that supports multithreading. You can use curl_multi_init () in php () to simulate parallel processing and multi-threaded program functions. You can also use curl_multi_init () to simulate multi-thread submission. As shown in the following program
Php does not want java to inherit the Thread interface directly or implement the Runnable interface for multi-Thread development. However, php provides a powerful curl tool that supports multithreading,
In php, you can use curl_multi_init () to simulate parallel processing and multi-threaded program functions. You can also use curl_multi_init () to simulate multi-thread submission. As shown in the following program:
$ Url) {$ conn [$ I] = curl_init ($ url); curl_setopt ($ conn [$ I], CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ conn [$ I], CURLOPT_POST, 1); curl_setopt ($ conn [$ I], CURLOPT_POSTFIELDS, array ('offset' => $ I); // submit data curl_multi_add_handle ($ mh, $ conn [$ I]);} do {$ status = curl_multi_exec ($ mh, $ active); $ info = curl_multi_info_read ($ mh); if (false! ==$ Info) {// var_dump ($ info) ;}} while ($ status === CURLM_CALL_MULTI_PERFORM | $ active ); foreach ($ urls as $ I =>$ url) {$ res [$ I] = curl_multi_getcontent ($ conn [$ I]); // obtain the returned content curl_close ($ conn [$ I]);} echo""; Print_r ($ res); $ etime = microtime (true); // get the execution end time of the program $ total = $ etime-$ stime; // calculate the difference value $ str_total = var_export ($ total, TRUE); echo $ str_total;
The program starts seven curls respectively to index. the php page sends a request in index. php can process the request based on the sent parameters, and simulate parallel multi-process submission ..... it can also be appliedTest data access!