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 {
//方法
}
}
?>热门推荐
1 狗狗技能训练
5 如何训练狗狗笑
6 狗狗训练排便
9 狗狗响片训练
10 如何训练狗狗不捡食
11 狗狗尿训练
12 怎么训练狗狗找东西
13 狗狗训练站立
14 狗狗训练飞盘
15 鞍山狗狗训练
16 怎样训练泰迪狗狗谢谢
17 狗狗外出训练
18 怎么训练金毛狗狗大小便