Does php have a function that is returned immediately after the script is called? For example, a php file named a. php can be executed in about 2 minutes. Is there a function that can be executed on this file? Just wake up a. php and let it execute. the main program immediately returns to handle other things ., The fsockopen () function may solve your problem. does http: // qian php have a function that is returned immediately after the script is called?
For example, a php file named a. php can be executed in about 2 minutes. Is there a function that can be executed on this file?
Just wake up a. php and let it execute. the main program immediately returns to handle other things.
------ Solution --------------------
The fsockopen () function may solve your problem.
Http://qianxunniao.iteye.com/blog/1243602
------ Solution --------------------
How does test get my reply?
You can also use php to call external commands to execute B. php.
------ Solution --------------------
Here is a function available in multiple environments.
But it cannot be used in your environment.
PHP code
/*** Function tenor ** starts a url, but does not wait to return * parameter $ page. the page program to be executed * returns none **/if (! Function_exists ('tenor'): function tenor ($ page) {$ host = $ _ SERVER ["HTTP_HOST"]; $ fp = fsockopen ($ host, 80, $ errno, $ errmsg); if (! $ Fp) {echo "$ errstr ($ errno)
\ N ";}else {fputs ($ fp," GET/$ page HTTP/1.0 \ nHost: $ host \ n "); fclose ($ fp ); // this line may need to be commented out} endif;
------ Solution --------------------
Php does not support multithreading, let alone the main thread and sub-thread. But there is a way to simulate this environment, the code is as follows:
Do {
? $ Mrc = curl_multi_exec ($ mh, $ active );
? } While ($ mrc = CURLM_CALL_MULTI_PERFORM );
? While ($ active and $ mrc = CURLM_ OK ){
? If (curl_multi_select ($ mh )! =-1 ){
? Do {
? $ Mrc = curl_multi_exec ($ mh, $ active );
? } While ($ mrc = CURLM_CALL_MULTI_PERFORM );
? }
? }
? It is simulated through a continuous loop,
If this method doesn't work, use the scheduled tasks of the system to regularly execute the program ~
------ Solution --------------------
For this kind of thing, use C. php only lives for the Web ..
The specific program architecture must be clearly described.