如何在不等待结果的情况下将 SQL 查询发送到 PHP 中的数据库 [英] How to send a SQL query to database in PHP without waiting for result

查看:14
本文介绍了如何在不等待结果的情况下将 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 中的数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆