标签:psr-0
1、PSR-0规范2、案例
[1]目录结构
[2]源码
index.php
<?php define('BASEDIE',__DIR____); require_once('/Config/Loader.php'); spl_autoload('\\Config\\Loader.php::autoload'); Config\Object::test(); App\Home\Index::test();
<?php namespace Config; class Object{ static function test(){ echo "nihao"; } }
<?php namespace Config; class Loader{ static function autoload($class) { require_once(BASEDIE.'/Config/'.str_replace('\\','/',$class).'.php'); } }
<?php namespace App\Home; class Index{ static function test(){ echo "ceshixinxi"; } }
标签:psr-0
原文地址:http://blog.csdn.net/zhao1234567890123456/article/details/41628163