开发者

Avoid 'waiting for response' in php?

开发者 https://www.devze.com 2023-01-21 10:16 出处:网络
I have a php script that uses exec() function to execute curl to download file. The file is about 600mb. So when I acess the php file on a browser, browsers shows me \'waiting for response\' message.

I have a php script that uses exec() function to execute curl to download file. The file is about 600mb. So when I acess the php file on a browser, browsers shows me 'waiting for response' message.

How do I avoid that?

my php source is

$a = exec("curl 'http://lab.test.com/test开发者_StackOverflow/test/down.php?c=23212' -o 'test.avi'");


For a Linux host, you should only need to add & to the end of your exec() call:

$a = exec("curl 'http://lab.test.com/test/test/down.php?c=23212' -o 'test.avi' &");

It's a little more complex for Windows:

$WshShell = new COM("WScript.Shell");
$a = $WshShell->Run("curl 'http://lab.test.com/test/test/down.php?c=23212' -o 'test.avi'", 0, false);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号