为什么我的pdo fetch_OBJ返回致命错误:未定义的类常量

时间:2017-05-07 07:57:16

标签: php mysql pdo

  

致命错误:未定义的类常量' Fetch_OBJ'在第23行的C:\ xampp \ htdocs \ index.php

<?php

try {
  $pdo = new PDO('mysql:host=127.0.0.1;dbname=neon', 'root','');
} catch (PDOException $e) {
  die('could not connect.');
}

$statement =$pdo->prepare('select * from team');
$statement->execute();

$sql = $statement->fetchAll(PDO::Fetch_OBJ);

var_dump($sql[0]->Name);

require 'index.view.php';
?>

1 个答案:

答案 0 :(得分:1)

FETCH_OBJ将是常量名称