Call another PHP script and return control to user before the other script completes

前端 未结 4 2063
情话喂你
情话喂你 2020-11-30 14:50

I\'m actually trying to apply this to a script that sends email. The sending email part takes a few seconds which is too long. What I want is for the first script to do its

4条回答
  •  执笔经年
    2020-11-30 15:17

    You can also call the shell and manually call the PHP file. No cron required and no waiting.

    http://www.php.net/manual/en/function.exec.php

    From the Notes Section

    "If a program is started with this function, in order for it to continue running in the background, the output of the program must be redirected to a file or another output stream. Failing to do so will cause PHP to hang until the execution of the program ends."

提交回复
热议问题