关于get_include_path()和set_include_path()

来源:互联网 发布:怎么看网络nat类型 编辑:程序博客网 时间:2024/04/30 07:56

get_include_path()    include包含文件所在的所有目录          格式如下  目录;目录;目录

通过set_include_path()可以修改这些目录

 

PATH_SEPARATOR 分隔符 Linux(:) Windows(;)

例如

3个文件夹 "file01","file02","file03"

$include_path=get_include_path().PATH_SEPARATOR."file01/".PATH_SEPARATOR."file02/".PATH_SEPARATOR."file03/";

set_include_path($include_path);

 

function__autoload($className){

           include strtolower($className).".class.php"; 

}

 

$class1=new Class1;

php会按顺序查找file01,file02,file03目录下是否包含 class1.class.php  这个文件 没有返回false,有则自动包含并停止查找

 

原创粉丝点击