开发者

Make an AJAX call to a php file --> then quit browser --> will the php file still run completely?

开发者 https://www.devze.com 2023-01-13 14:51 出处:网络
If a user clicks a button that will make an ajax post call to a php file, then navigates away from the website or closes the window, will the php file run completely until it finishes?

If a user clicks a button that will make an ajax post call to a php file, then navigates away from the website or closes the window, will the php file run completely until it finishes?

i want the file to download stuff to my server a开发者_运维问答nd post a bunch of information into a mysql database. This could take a minute or two. But i want the task to finish completely no matter what the user does.

if the ajax post/request gets sent, will the file run through completely?

thanks for any info.


This should help:

ignore_user_abort(true);
set_time_limit(0);       // number of seconds (0 infinity)

Check out the documentation for those two functions for more insight. In general, you shouldn't have a problem, as long as you don't run up against the time limit. This should have all the info you need:

http://us3.php.net/manual/en/features.connection-handling.php


this helped me understand:

http://www.php.net/manual/en/features.connection-handling.php

0

精彩评论

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