How to send a SQL query to database in PHP without waiting for result(如何在不等待结果的情况下将 SQL 查询发送到 PHP 中的数据库)
问题描述
使用 DB2 和 PHP,我的 ADD 和 DROP 需要很长时间才能完成(每个 ADD 和 DROP 30 秒).我很好奇是否有办法在不让 PHP 等待响应的情况下将我的 ADD 和 DROP 发送到数据库?
Working with DB2 and PHP, my ADDs and DROPs take a long time to finish (30 seconds per ADD and DROP). I am curious if there is a way to send my ADDs and DROPs to the database without having PHP wait for a response?
推荐答案
我相当肯定大多数 php db 控件没有异步方法(太糟糕了).假设您只需要执行不与最终用户交互的数据库语句,您可以使用 pcntl_fork
.如果你需要别的东西,像 这个可能更有用.
I'm fairly certain that most php db controls don't have async methods (too bad). Presuming that you just need to do DB statements that don't interact with the end user you could use pcntl_fork
. If you need something else, a solution like this may be more useful.
这篇关于如何在不等待结果的情况下将 SQL 查询发送到 PHP 中的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何在不等待结果的情况下将 SQL 查询发送到 PHP 中的数据库


基础教程推荐
- Yii2 - 在运行时设置邮件传输参数 2022-01-01
- php中的PDF导出 2022-01-01
- 将变量从树枝传递给 js 2022-01-01
- 如何在数学上评估像“2-1"这样的字符串?产生“1"? 2022-01-01
- php中的foreach复选框POST 2021-01-01
- php 7.4 在写入变量中的 Twig 问题 2022-01-01
- 主题化 Drupal 7 的 Ubercart “/cart"页 2021-01-01
- PHPUnit 的 Selenium 2 文档到底在哪里? 2022-01-01
- Web 服务器如何处理请求? 2021-01-01
- 使用 scandir() 在目录中查找文件夹 (PHP) 2022-01-01