spl_autoload_register 自动载入

<?php

spl_autoload_register('autoload1');
spl_autoload_register('autoload2');

test1::test();
test2::test();


function autoload1($class){
include strp(__DIR__).'/'.$class.'.php';
}

function autoload2($class){
include strp(__DIR__).'/'.$class.'.php';
}
function strp($path){
return str_replace('\\', '/', $path);
}


?>

posted @ 2015-09-14 22:13  荒野野狼  阅读(130)  评论(0编辑  收藏  举报