PHP中的interface_exists()函数
interface_exists()函数检查接口是否已定义。如果已经定义了name_of_interface给定的接口,则返回TRUE,否则返回FALSE。
语法
interface_exists(name_of_interface, autoload)
参数
name_of_interface-接口名称。
autoload-默认情况下是否调用__autoload
返回
如果已经定义了name_of_interface给定的接口,则interface_exists()函数将返回TRUE。否则返回FALSE。
示例
以下是一个例子-
<?php
if (interface_exists('DemoInterface')) {
class MyClass implements DemoInterface {
//方法
}
}
?>热门推荐
3 祝福语简短的微信
10 幼儿祝福语大全简短贺卡
11 感谢教官文案祝福语简短
12 鼠年同事祝福语简短创意
13 元旦祝福语 简短独特群发
14 妈咪跟我生日祝福语简短
15 给儿子新婚祝福语简短
16 伴娘祝福语长文案简短
17 恭喜高考完祝福语简短
18 生日祝福语送老公简短