(PHP 5 >= 5.0.2, PHP 7)
interface_exists — 锟斤拷锟接匡拷锟角凤拷锟窖憋拷锟斤拷锟斤拷
$interface_name
[, bool $autoload
= true
] ) : bool锟斤拷锟接匡拷锟角凤拷锟窖憋拷锟斤拷锟藉。
锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 interface_name
锟斤拷锟斤拷锟侥接匡拷锟窖讹拷锟斤拷时锟斤拷锟斤拷 TRUE
锟斤拷锟斤拷锟津返伙拷 FALSE
锟斤拷
Example #1 interface_exists() 锟斤拷锟斤拷
<?php
// 锟节筹拷锟斤拷使锟斤拷前锟饺硷拷锟接匡拷锟角凤拷锟斤拷锟�
if (interface_exists('MyInterface')) {
class MyClass implements MyInterface
{
// Methods
}
}
?>