简体   繁体   中英

AJAX + PHP: Get the server to work after page closes

I have a question regarding Ajax and PHP, basically I have a function that has to fire "silently" on a certain action and this consist of sending thru an FTP and DB connection data from this site to another one.

The point is that I need to press the button, the Ajax sends a request and the users sees "Ok the server is taking care of this" and he may close (or not the page).

This said, let's say the user changes or closes the page, what I need to know is whether or not the PHO request will carry on and will finish (eventually sending a mail when done) or if this will be interrupted by user changing page or what ever reason.

I don't have enough reputation to comment on this.

I want to say that I have lots of crons which are running at night and they take about 1 hour to end, once they end they email me the result.

If I call them manually, after 30 sec I get a server error, but if I check the log files i see that they continue to work fine.

To make sure you can create a log file and see the result ( tail -f 'log.txt').

Its working fine for me and does not stop after client expire time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM