手册上搜method_exists,搜到这个
<?php
$directory = new Directory('.');
var_dump(method_exists($directory,'read'));//请解释一下,此处的read方法哪里来的,属于哪里,顺便举一个其它实例
?>
<?php
$directory = new Directory('.');
var_dump(method_exists($directory,'read'));//请解释一下,此处的read方法哪里来的,属于哪里,顺便举一个其它实例
?>
function hello(){
echo "hello world";
}
}
$a = new say;
if (method_exists($a,"hello")){
echo "方法hello存在";
}else{
echo "方法hello不存在";
}
method_exists($directory,'read')
的意思是判断 $directory对象是否存在 read()方法