2

我有一颗彗星,我以这种方式运行一个while循环

$items = $statement->fetchAll();//statement is a PDO Statement
$iteration = 0;
while(count($items) == 0 && $iteration < 100){
    $items = $statement->fetchAll();
    usleep(10000);
    ++$iteration;
}

当彗星运行时,我可以看到所有其他 HTTP 请求都处于待处理状态。甚至非数据库请求也处于待处理状态。为什么 ?

4

1 回答 1

1

您需要手动提交使用PDO::commit,因为请求被保留在事务中。

请参阅有关此行为的文档:

http://www.php.net/manual/de/pdo.commit.php

http://www.php.net/manual/en/pdo.transactions.php

于 2012-06-20T19:54:13.310 回答