stdClass
is just a generic 'empty' class that's used when casting other types to objects.
(stdClass
只是将其他类型强制转换为对象时使用的通用“空”类。)
Despite what the other two answers say, stdClass
is not the base class for objects in PHP. (尽管有其他两个答案, stdClass
并不是 PHP中对象的基类。)
This can be demonstrated fairly easily: (这可以很容易地证明:)
class Foo{}
$foo = new Foo();
echo ($foo instanceof stdClass)?'Y':'N';
// outputs 'N'
I don't believe there's a concept of a base object in PHP
(我不相信PHP中有基础对象的概念)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…