框架雏形
1.入口文件 index.php
<?php include __DIR__.'/Common/Autoload.php'; define("ROOT",__DIR__); spl_autoload_register("\\Common\\Autoload::load");autoload.phpApplication\Contorle\Test::demo();?>
<?php namespace Common; class Autoload{ static function load($class){ include ROOT.'/'.$class.'.php'; } }test.php
<?php namespace Application\Contorle; class Test{ static function demo(){ echo ''; } }
完成上述步骤以后,就可以,免include文件,也可以调用static方法!