Skip to content

Instantly share code, notes, and snippets.

@noname007
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noname007/86fa1fe01878b8ccee6a to your computer and use it in GitHub Desktop.
Save noname007/86fa1fe01878b8ccee6a to your computer and use it in GitHub Desktop.
spl_autoload_register类的自动加载
<?php
function import($classname)
{
$filename = __DIR__.'/class/'.$classname.'.php';
if(is_file($filename))
{
require $filename;
}else {
die('Not Find the file '.$filename);
}
}
spl_autoload_register('import');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment