手册上搜method_exists,搜到这个
<?php
$directory = new Directory('.');
var_dump(method_exists($directory,'read'));//请解释一下,此处的read方法哪里来的,属于哪里,顺便举一个其它实例
?>

解决方案 »

  1.   

    class say{
    function hello(){
          echo "hello world";
       }
    }
    $a = new say;
    if (method_exists($a,"hello")){
       echo "方法hello存在";
    }else{
        echo "方法hello不存在";
      

  2.   

    $directory 是类对象
    method_exists($directory,'read')
    的意思是判断 $directory对象是否存在 read()方法
      

  3.   

    2楼的同志,我知道是对象,但是能说一下Directory这个类是怎么来的吗?是php 内置类吗?