RT,不要对include的文件做改动。

解决方案 »

  1.   

    以前也找过这种接口,不过没找到。
    所以换用了另一种方法,把类或方法单独写在一个文件,然后再class_exists() ,function_exists() 检测
      

  2.   

    额 既然不能改动被include的文件 那就include方吧 来个include计数器 每次include都给计数器里该文件+1好吧我是来扯淡的,感觉3L的办法挺好。
      

  3.   

    回楼上:
    可以被动的include文件。可以参考下php5的magic函数:__autoload,在你的class里面实现这个方法,当此类被调用时这个方法就会触发,然后可以在这个方法中进行require_once $class_name . '.php';
    楼主的问题,其实我们一般都是按照2楼的方法来解决的。class_exists() ,function_exists(),或是isset()都可以间接的判断某个类是否被include了。
      

  4.   

    可以呀,include_once()、require_once()函数就是来实现这个的呀,当已经加载过一次某文件,php是知道的,如果想在程序中判断是否加载了,用define或if来就能实现
      

  5.   

    10楼被忽略了.....哈哈,
    再重复一遍: get_included_files虽然楼主可能只是要autoload或者include_once/require_once
      

  6.   

    helloyou0 表示很无奈.get_included_files
    Gets the names of all files that have been included using include(), include_once(), require() or require_once().Returns an array of the names of all files.The script originally called is considered an "included file," so it will be listed together with the files referenced by include() and family.Files that are included or required multiple times only show up once in the returned array.