ajax asynchronous request php background processing time-consuming task session_write_close

WBOY
Release: 2016-07-29 09:11:13
Original
1542 people have browsed it

Problem: After ajax asynchronously requests PHP background processing time-consuming tasks, the js after ajax can run normally, but the current browser can no longer click to browse other pages at the address requested by ajax (stuck, blocked) .
Solution:
First, the front end is normal ajax request.
Second, these three sentences must be added to the PHP background method:
ignore_user_abort(); //Detach from the client
set_time_limit(0); //Execute without time limit
session_write_close(); //Session unlock
session_write_close() is The important point is that the background execution is not completed and the session is locked, so session_write_close — Write session data and end session needs to be added.

The above introduces the time-consuming task session_write_close of ajax asynchronous request to PHP background processing, including the ajax content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template