<?php /* @desc:自動加載類的函數 @param dir 須要註冊自動加載的文件夾 */ function autoloader($dir){ spl_autoload_register(function($name) use ($dir){ $name = str_replace('\\',DIRECTORY_SEPARATOR,$name); require $dir.DIRECTORY_SEPARATOR.$name.'.php'; }); }
autoloader('a'); use a\config; $config = new config(); $config->say();
hello