關於get_include_path()和set_include_path()

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,有則自動包含並停止查找

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章