Does PHP have a function that returns immediately after invoking the script?
For example, there is a php file a.php, it will take about 2 minutes to execute, there is no function, you can let this file execution, not wait for it to run out?
Just wake up the a.php and let it execute, and the main program returns to handle something else immediately.
------Solution--------------------
The Fsockopen () function might solve your problem.
http://qianxunniao.iteye.com/blog/1243602
------Solution--------------------
Why is test always eating my reply?
You can also use PHP to invoke external commands to execute b.php
------Solution--------------------
Give you a function that is available in my multiple environments.
But it's not guaranteed to be useful in your environment.
PHP Code
/** * Function Tenor * Function starts a URL, but does not wait to return * parameter $page, the page program to be executed * returns no **/if (! function_exists (' tenor ')): function tenor ($page) { $host = $_server["Http_host"]; $fp = Fsockopen ($host, $errno, $errmsg); if (! $fp) {echo ' $errstr ($errno)
\ n "; } else {fputs ($fp, "get/$page http/1.0\nhost: $host \ n"); Fclose ($FP);//may need to comment out the line}}endif;
------Solution--------------------
PHP does not support multithreading, not to mention the main thread and child threads. 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);
? }
? }
? is simulated through a loop that is constantly executing,
If this is not possible, use the system's scheduled tasks to execute the program regularly.
------Solution--------------------
This kind of thing still use C bar, PHP just for the web and live.
Specific program architecture How to design also have to clarify the function description.