只是使用这个功能,它没有按计划进行.它应该抓取数据库中的所有表名并将它们存储在一个数组中.但是,数组的结果使下面示例中显示的数组加倍:
原文链接:https://www.f2er.com/php/134991.htmlArray ( [0] => 113340 ) Array ( [0] => 113340 [1] => 116516 ) Array ( [0] => 113340 [1] => 116516 [2] => 139431 ) Array ( [0] => 113340 [1] => 116516 [2] => 139431 [3] => 20731 ) Array ( [0] => 113340 [1] => 116516 [2] => 139431 [3] => 20731 ... )
我正在使用的代码:
function itemDiscontinued($dbh,$id,$detail) { try { $tableList = array(); $result = $dbh->query("SHOW TABLES"); while ($row = $result->fetch(PDO::FETCH_NUM)) { $tableList[] = $row[0]; print_r($tableList); } } catch (PDOException $e) { echo $e->getMessage(); } }