Does PHP have a function that returns immediately after invoking the script? What to do with it

Source: Internet
Author: User
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.
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.