php 自動加載 __autoload()

//這裏是絕對路徑
set_include_path(implode(PATH_SEPARATOR, array(
    realpath('/opt/www/wcms/lib'),

    get_include_path())));

//這個方法php

function __autoload($className)
{
    //若是加這個檢測, 由於此文件不在當前目錄下,它就會檢測不到文件存在,
    //但include是能成功的

        require_once $className . '.php';

}

$erpSer=new ERPService();
$erpSer->batchDeliver();
相關文章
相關標籤/搜索