/** * */ function __construct() { //AutoClassLoader确保序列化后自动加载类文件 $this->class_loader = new AutoClassLoader(); ClassLoader::addInclude($this->api_path); //TODO: 支持名字空间 //TODO: 支持多路径多类名 $this->load($this->api_path, $this->apis, $this->api_method); //允许通过接口访问api信息 if ($this->export_apis) { $this->loadApi($this->routes, __DIR__ . '/apis/ApiExporter.php', 'phprs\\apis\\ApiExporter'); } }
<?php /** * $Id: AutoLoad.php 56761 2014-12-08 05:17:37Z caoyangmin $ * @author caoyangmin(caoyangmin@gmail.com) * @brief AutoLoad */ namespace phprs; require __DIR__ . '/util/ClassLoader.php'; require __DIR__ . '/util/AutoClassLoader.php'; use phprs\util\ClassLoader; ClassLoader::addInclude(dirname(__DIR__)); spl_autoload_register(array(__NAMESPACE__ . '\\util\\ClassLoader', 'autoLoad'));