<?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