⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mysqli_fetch_object.phpt

📁 linux下安装不上mysql5与php5的可用此关联
💻 PHPT
字号:
--TEST--mysqli_fetch_object()--SKIPIF--<?php require_once('skipif.inc'); ?><?php require_once('skipifemb.inc'); ?>--FILE--<?php    include "connect.inc";    $tmp    = NULL;    $link   = NULL;    if (!is_null($tmp = @mysqli_fetch_object()))        printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);    if (!is_null($tmp = @mysqli_fetch_object($link)))        printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);                    require('table.inc');    if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST ORDER BY id LIMIT 5")) {        printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));    }        $obj = mysqli_fetch_object($res);    if (($obj->ID !== "1") || ($obj->label !== "a") || (get_class($obj) != 'stdClass')) {        printf("[004] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));        var_dump($obj);    }            class mysqli_fetch_object_test {                public $a = null;        public $b = null;                              public function toString() {            var_dump($this);        }            }        $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_test');    if (($obj->ID !== "2") || ($obj->label !== "b") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_test')) {        printf("[005] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));        var_dump($obj);    }                class mysqli_fetch_object_construct extends mysqli_fetch_object_test {                public function __construct($a, $b) {            $this->a = $a;            $this->b = $b;        }            }        $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', null);        if (($obj->ID !== "3") || ($obj->label !== "c") || ($obj->a !== NULL) || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {        printf("[006] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));        var_dump($obj);    }        $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a'));    if (($obj->ID !== "4") || ($obj->label !== "d") || ($obj->a !== 'a') || ($obj->b !== NULL) || (get_class($obj) != 'mysqli_fetch_object_construct')) {        printf("[007] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));        var_dump($obj);    }        $obj = mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b'));        if (($obj->ID !== "5") || ($obj->label !== "e") || ($obj->a !== 'a') || ($obj->b !== 'b') || (get_class($obj) != 'mysqli_fetch_object_construct')) {        printf("[008] Object seems wrong. [%d] %s\n", mysqli_errno($link), mysqli_error($link));        var_dump($obj);    }        var_dump(mysqli_fetch_object($res, 'mysqli_fetch_object_construct', array('a', 'b', 'c')));        var_dump(mysqli_fetch_object($res));        mysqli_free_result($res);         if (!$res = mysqli_query($link, "SELECT id AS ID, label FROM test AS TEST")) {        printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));    }            mysqli_free_result($res);        var_dump(mysqli_fetch_object($res));        // Fatal error, script execution will end    var_dump(mysqli_fetch_object($res, 'this_class_does_not_exist'));                mysqli_close($link);    print "done!";?>--EXPECTF--Warning: Missing argument 1 for mysqli_fetch_object_construct::__construct() in %s on line %dWarning: Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %dNotice: Undefined variable: a in %s on line %dNotice: Undefined variable: b in %s on line %dWarning: Missing argument 2 for mysqli_fetch_object_construct::__construct() in %s on line %dNotice: Undefined variable: b in %s on line %dNULLNULLWarning: mysqli_fetch_object(): Couldn't fetch mysqli_result in %s on line %dNULLFatal error: Class 'this_class_does_not_exist' not found in %s on line %d

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -