• 首页
  • vue
  • TypeScript
  • JavaScript
  • scss
  • css3
  • html5
  • php
  • MySQL
  • redis
  • jQuery
  • ReflectionProperty::getDeclaringClass()

    (PHP 5, PHP 7)

    Gets declaring class

    说明

    publicReflectionProperty::getDeclaringClass(void) :ReflectionClass

    Gets the declaring class.

    Warning

    本函数还未编写文档,仅有参数列表。

    参数

    此函数没有参数。

    返回值

    AReflectionClassobject.

    参见

    • ReflectionProperty::getName() Gets property name
    If you're reflecting an object and get the declaring class of a property that's set but wasn't declared in any class, it returns the class of the instance.
    <?php
    class X {
      
    }
    $x = new X();
    $x->foo = 'bar';
    $reflection = new ReflectionObject($x);
    echo $reflection->getProperty('foo')->getDeclaringClass() >getName(); // X
    ?>