当没有找到记录时,PDOStatement :: fetch()或fetchAll()方法会返回什么? (PHP + MySQL)

$dbh = new PDO($dsn, $username, $password);
$stmt = $dbh->query($query);
$array = $stmt->fetch();
$stmt->closeCursor();

What would fetch() or fetchAll() method return when no records were found?

  • An empty array?
  • A non-empty array with field names as the keys and NULLs as the values?
  • A NULL value?
  • A FALSE value?
  • Or just to trigger an error?

The answer is a FALSE, after I tested it myself.