Webでオブジェクト指向プログラミング
■ このスレッドは過去ログ倉庫に格納されています
0062nobodyさん
2005/12/22(木) 05:39:54ID:???__autoloadの中を頑張ってつくればある意味Javaのパッケージより柔軟に色々できると思う。
今即興で考えてみたけどこんなのどう?
function __autoload($class, $newdir = "") {
static $dirs = array();
if ($newdir) $dirs[] = $newdir;
if ($class) foreach ($dirs as $dir) {
$file = "$dir/$class.class.php";
if (file_exists($file)) { require_once $file; return; }
}
}
function add_import_dir($dir) {
__autoload("", $dir);
}
なんか書いてて虚しくなってきたよ・・・
■ このスレッドは過去ログ倉庫に格納されています