How does the PHP parent script concurrently call the child script without waiting? I have compiled a PHP system and need to call 1.php and 2.php in the parent script father. php. 1. php, 2.php, these two subscripts are executed for a long time and cannot affect the execution of normal scripts in 2.php and father. php because 1.php is called. I mean, when the parent process father. php calls 1.php, 1. php will execute the PHP parent script in the background. how can I concurrently call the subscript without waiting?
I have compiled a PHP system and need to call 1.php and 2.php in the parent script father. php.
1. php, 2.php, these two subscripts are executed for a long time and cannot affect the execution of normal scripts in 2.php and father. php because 1.php is called.
I mean, when the parent process is father. php calls 1.php, 1. php will be executed in the background, but father. the php script is still executed to call 2.php, so that 2. php is also executed in the background, after calling 2. after php, father. php code continues to be executed. at this time, 1.php and 2.php are also concurrently executed in the background.
Instead of using father. php to call 1.php, wait until the execution of 1.php is complete before calling 2.php. wait until the execution of 2.php is complete before executing the subsequent code.
To sum up, the external script is called concurrently and executed in the background of the called Script. the parent script continues to run normally without waiting for the child script.
Do I understand? Thank you.
------ Solution --------------------
Yes. search for php execution in the background.
------ Solution --------------------
Use pcntl_fork to generate a sub-process and execute it in the sub-process.
------ Solution --------------------
Write a shell to call the function.