PHP、Ajax 和请求的生命周期

标签 php jquery http multithreading

我想知道通过 Ajax 调用 PHP 脚本的生命周期。假设服务器上有一个长时间运行(即 30 秒)的 PHP 脚本,并且该页面是通过 Ajax 加载的。在脚本完成之前,用户关闭浏览器。脚本是否继续运行直至完成,是否终止,或者这是服务器本身的功能(我正在运行 Apache fwiw)。感谢您的帮助。

最佳答案

这可能令人感兴趣:ignore_user_abort()

ignore_user_abort — Set whether a client disconnect should abort script execution

但是请注意

PHP will not detect that the user has aborted the connection until an attempt is made to send information to the client.

关于PHP、Ajax 和请求的生命周期,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3002058/

相关文章:

javascript - 发送表单 POST 时不带参数

javascript - 如何从 ajax 调用中模拟 501 错误

javascript - 未捕获的 TypeError : $. 咆哮不是函数

php - 表单提交后替换div内容

php - nginx_http_push_module 和数据库

javascript - 定义 Kendo UI 默认值和功能

ios - 从 iOS 应用程序将凭据传递到 Safari

php - 面包屑 : change links depending on where I am

javascript - .prepend 不是函数

javascript - 将 jquery 转换为 javascript 以帮助显示 div?