我有连接和所有数据库操作的类mysql。 mysqli连接是该类的私有成员。我试图使用MYSQLI_ASYNC进行查询并使用mysqli_poll轮询连接。对于mysqli_poll(读取,错误,拒绝),read,error和rejects数组具有mysqli连接,即分配给它的类的成员。我面临mysqli_poll错误 - 没有传递流数组。有什么想法吗?
class MySQL
{
private $mysqli = null;
public function dbconnect()
{
$mysqli = mysqli_connect(host,username,password,dbname);
$this->mysqli = $mysqli;
}
private function queryop($query)
{
$links = $errors = $reject = array();
$links[] = $this->mysqli;
$mysqli_result = $this->mysqli->query($query, MYSQLI_ASYNC | MYSQLI_STORE_RESULT);
$stime = microtime(true);
do {
if (!mysqli_poll($links, $error, $reject, 0, 1000)) {
continue;
}
$mysqli_result = $this->mysqli->reap_async_query();
echo "query finished";
break;
} while ((microtime(true)- $stime) < 5);
echo "time --".(microtime(true)- $stime)."---";
}
}
mysqli_poll正在发出警告 - 没有传递流数组