如何在PHP中发送SQL查询到数据库,而无需等待结果 [英] How to send a SQL query to database in PHP without waiting for result

查看:258
本文介绍了如何在PHP中发送SQL查询到数据库,而无需等待结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用DB2和PHP,我的ADD和DROP需要很长时间才能完成(每个ADD和DROP为30秒)。如果有没有办法将我的ADD和DROP发送到数据库,而不用PHP等待响应,我很好奇

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.

这篇关于如何在PHP中发送SQL查询到数据库,而无需等待结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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