略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: ReflectionClass::getInterfaces

2024-04-28

ReflectionClass::getInterfaces

(PHP 5, PHP 7, PHP 8)

ReflectionClass::getInterfaces获取接口

说明

public ReflectionClass::getInterfaces(): array

获取接口。

参数

此函数没有参数。

返回值

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

范例

示例 #1 ReflectionClass::getInterfaces() 例子

<?php
interface Foo { }

interface 
Bar { }

class 
Baz implements FooBar { }

$rc1 = new ReflectionClass("Baz");

print_r($rc1->getInterfaces());
?>

以上例程的输出类似于:

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

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

)

参见

add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/reflectionclass.getinterfaces.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3