class_implements

(PHP 5, PHP 7)

class_implements 锟斤拷锟斤拷指锟斤拷锟斤拷锟斤拷实锟街碉拷锟斤拷锟叫接口★拷

说锟斤拷

class_implements ( mixed $class [, bool $autoload ] ) : array

锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷一锟斤拷锟斤拷锟介,锟斤拷锟斤拷锟斤拷锟叫帮拷锟斤拷锟斤拷指锟斤拷锟斤拷class锟斤拷锟戒父锟斤拷锟斤拷实锟街碉拷锟斤拷锟叫接口碉拷锟斤拷锟狡★拷

锟斤拷锟斤拷

class

锟斤拷锟斤拷锟斤拷实锟斤拷锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟狡o拷锟斤拷

autoload

锟角凤拷锟斤拷锟斤拷使锟斤拷__autoload 魔锟斤拷锟斤拷锟斤拷锟斤拷锟皆讹拷装锟截革拷锟洁。默锟斤拷值为TRUE锟斤拷

锟斤拷锟斤拷值

锟斤拷锟矫成癸拷锟津返伙拷一锟斤拷锟斤拷锟介,锟斤拷锟津返伙拷FALSE锟斤拷

锟斤拷锟斤拷锟斤拷志

锟芥本 说锟斤拷
5.1.0 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�class为锟街凤拷锟斤拷锟斤拷选锟筋。锟斤拷锟斤拷锟斤拷autoload锟斤拷锟斤拷锟斤拷

锟斤拷锟斤拷

Example #1 class_implements() example

<?php

interface foo { }
class 
bar implements foo {}

print_r(class_implements(new bar));

// since PHP 5.1.0 you may also specify the parameter as a string
print_r(class_implements('bar'));


function 
__autoload($class_name) {
   require_once 
$class_name '.php';
}

// use __autoload to load the 'not_loaded' class
print_r(class_implements('not_loaded'true));

?>

锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�

Array
(
    [foo] => foo
)

Array
(
    [interface_of_not_loaded] => interface_of_not_loaded
)

锟轿硷拷

  • class_parents() - 锟斤拷锟斤拷指锟斤拷锟斤拷母锟斤拷唷�
  • get_declared_interfaces() - 锟斤拷锟斤拷一锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷慕涌锟�