PDOStatement::fetchObject

PHP PDO 参考手册PHP PDO Reference Manual

PDOStatement::fetchObject — Fetches the next row and returns it as an object. (PHP 5 >= 5.1.0, PECL pdo >= 0.2.4)


Description

Syntax

mixed PDOStatement::fetchObject ([ string $class_name = "stdClass" [, array $ctor_args ]] )

Fetches the next row and returns it as an object. This function (method) is an alternative to PDOStatement::fetch() using PDO::FETCH_CLASS or PDO::FETCH_OBJ style.


Parameters

class_name

The name of the class to create.

ctor_args

The elements of this array are passed to the constructor.


Return Values

Returns an instance of the requested class with property names that correspond to the column names, or FALSE on failure.


PHP PDO 参考手册PHP PDO Reference Manual

Other Extensions