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

    (PHP 5, PHP 7)

    获取接口

    说明

    publicReflectionClass::getInterfaces(void): array

    获取接口。

    参数

    此函数没有参数。

    返回值

    接口的关联数组,数组键是接口(interface)的名称,数组的值是ReflectionClass对象。

    范例

    Example #1ReflectionClass::getInterfaces()例子

    <?php
    interface Foo { }
    interface Bar { }
    class Baz implements Foo, Bar { }
    $rc1 = new ReflectionClass("Baz");
    print_r($rc1->getInterfaces());
    ?>
    

    以上例程的输出类似于:

    Array
    (
        [Foo] => ReflectionClass Object
            (
                [name] => Foo
            )
        [Bar] => ReflectionClass Object
            (
                [name] => Bar
            )
    )
    

    参见

    • ReflectionClass::getInterfaceNames() 获取接口(interface)名称