工程目錄如下
<?php
final class Utils {
private function __construct() {
}
public static function getClasses($pre_path =
$classes = array(
);
return $classes;
}
}
?>
注意
<?php
require_once
final class Init {
/**
* System config
*/
public function init() {
// error reporting
// display_errors = On in your php
error_reporting ( E_ALL | E_STRICT );
mb_internal_encoding (
//registe classes
spl_autoload_register ( array ($this
}
/**
* Class loader
*/
public function loadClass($name) {
$classes = Utils::getClasses ();
if (! array_key_exists ( $name
die (
}
require_once $classes [$name];
}
}
$init = new Init ();
$init
?>
<?php
require_once
$dao = new UserDao();
$result = $dao
?>
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20464.html