我有一颗彗星,我用这种方式运行了一次while循环
$items = $statement->fetchAll();//statement is a PDO Statement
$iteration = 0;
while(count($items) == 0 && $iteration < 100){
$items = $statement->fetchAll();
usleep(10000);
++$iteration;
}当comet运行时,我可以看到所有其他HTTP请求都处于挂起状态。即使是非数据库请求也处于挂起状态。为什么?
发布于 2012-06-21 03:54:13
当请求被保存在事务中时,您需要使用PDO::commit手动提交。
请参阅有关此行为的文档:
http://www.php.net/manual/de/pdo.commit.php
http://www.php.net/manual/en/pdo.transactions.php
https://stackoverflow.com/questions/11126465
复制相似问题