<?php
define("DS", DIRECTORY_SEPARATOR);
define("PS", PATH_SEPARATOR);
error_reporting(E_ALL);
ini_set("display_error", "On");
spl_autoload_extensions(".dev.php,.php");//optional, and you can customize its parameter
$otherDir = dirname(dirname(dirname(__DIR__))).DS."other_lib";//other library path,you can customize this line
set_include_path("/your_path/library/class1/".PS."/your_path/library/class2/".PS.$otherDir. PATH_SEPARATOR . get_include_path() ); //you can customize parameter of this line
include_once("Autoload.php");
spl_autoload_register(array("Autoload", "handler"));
$obj = new Vendor\Cls(); // if there's /your_path/library/[class1 or class2]/Vendor/Cls.php file (depend on your include_path line 9), Autoload will help you to auto include it
$obj = new Library1();// directory of Library1 class, Autoload will help you to auto include Library1.php
Autoload::addIncludePath($otherDir. DS . "include");// directory of Library2 class
$obj = new Library2();
Autoload::register("Datamatrix",
array(
"path" => $otherDir. DS . "include" . DS . "barcodes",
"ext" => ".class.php",
"file" => "datamatrix"
)
);// with temporary path, ext, file. all of this three parameter are optional
$obj = new Datamatrix();
|