diff --git a/alias.php b/alias.php new file mode 100644 index 00000000..6515add6 --- /dev/null +++ b/alias.php @@ -0,0 +1,103 @@ + +// +---------------------------------------------------------------------- + +/** + * ThinkPHP 类库映射定义 + */ +return [ + 'think\App' => CORE_PATH . 'App' . EXT, + 'think\Build' => CORE_PATH . 'Build' . EXT, + 'think\Cache' => CORE_PATH . 'Cache' . EXT, + 'think\cache\driver\Apc' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Apc' . EXT, + 'think\cache\driver\File' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'File' . EXT, + 'think\cache\driver\Lite' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Lite' . EXT, + 'think\cache\driver\Memcache' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Memcache' . EXT, + 'think\cache\driver\Memcached' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Memcached' . EXT, + 'think\cache\driver\Redis' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Redis' . EXT, + 'think\cache\driver\Secache' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Secache' . EXT, + 'think\cache\driver\Sqlite' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Sqlite' . EXT, + 'think\cache\driver\Wincache' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Wincache' . EXT, + 'think\cache\driver\Xcache' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Xcache' . EXT, + 'think\Config' => CORE_PATH . 'Config' . EXT, + 'think\config\Ini' => CORE_PATH . 'config' . DS . 'driver' . DS . 'Ini' . EXT, + 'think\config\Json' => CORE_PATH . 'config' . DS . 'driver' . DS . 'Json' . EXT, + 'think\config\Xml' => CORE_PATH . 'config' . DS . 'driver' . DS . 'Xml' . EXT, + 'think\Console' => CORE_PATH . 'Console' . EXT, + 'think\Collection' => CORE_PATH . 'Collection' . EXT, + 'think\Controller' => CORE_PATH . 'Controller' . EXT, + 'think\controller\Hprose' => CORE_PATH . 'controller' . DS . 'Hprose' . EXT, + 'think\controller\Jsonrpc' => CORE_PATH . 'controller' . DS . 'Jsonrpc' . EXT, + 'think\controller\Rest' => CORE_PATH . 'controller' . DS . 'Rest' . EXT, + 'think\controller\Rpc' => CORE_PATH . 'controller' . DS . 'Rpc' . EXT, + 'think\controller\Yar' => CORE_PATH . 'controller' . DS . 'Yar' . EXT, + 'think\Cookie' => CORE_PATH . 'Cookie' . EXT, + 'think\Db' => CORE_PATH . 'Db' . EXT, + 'think\db\Connection' => CORE_PATH . 'db' . DS . 'Connection' . EXT, + 'think\db\connector\Mysql' => CORE_PATH . 'db' . DS . 'connector' . DS . 'Mysql' . EXT, + 'think\db\connector\Oracle' => CORE_PATH . 'db' . DS . 'connector' . DS . 'Oracle' . EXT, + 'think\db\connector\Pgsql' => CORE_PATH . 'db' . DS . 'connector' . DS . 'Pgsql' . EXT, + 'think\db\connector\Sqlite' => CORE_PATH . 'db' . DS . 'connector' . DS . 'Sqlite' . EXT, + 'think\db\connector\Sqlsrv' => CORE_PATH . 'db' . DS . 'connector' . DS . 'Sqlsrv' . EXT, + 'think\db\Builder' => CORE_PATH . 'db' . DS . 'Builder' . EXT, + 'think\db\builder\Mysql' => CORE_PATH . 'db' . DS . 'builder' . DS . 'Mysql' . EXT, + 'think\db\builder\Oracle' => CORE_PATH . 'db' . DS . 'builder' . DS . 'Oracle' . EXT, + 'think\db\builder\Pgsql' => CORE_PATH . 'db' . DS . 'builder' . DS . 'Pgsql' . EXT, + 'think\db\builder\Sqlite' => CORE_PATH . 'db' . DS . 'builder' . DS . 'Sqlite' . EXT, + 'think\db\builder\Sqlsrv' => CORE_PATH . 'db' . DS . 'builder' . DS . 'Sqlsrv' . EXT, + 'think\db\Query' => CORE_PATH . 'db' . DS . 'Query' . EXT, + 'think\Debug' => CORE_PATH . 'Debug' . EXT, + 'think\Error' => CORE_PATH . 'Error' . EXT, + 'think\Exception' => CORE_PATH . 'Exception' . EXT, + 'think\exception\DbException' => CORE_PATH . 'exception' . DS . 'DbException' . EXT, + 'think\exception\Handle' => CORE_PATH . 'exception' . DS . 'Handle' . EXT, + 'think\exception\HttpException' => CORE_PATH . 'exception' . DS . 'HttpException' . EXT, + 'think\exception\HttpResponseException' => CORE_PATH . 'exception' . DS . 'HttpResponseException' . EXT, + 'think\exception\PDOException' => CORE_PATH . 'exception' . DS . 'PDOException' . EXT, + 'think\exception\ErrorException' => CORE_PATH . 'exception' . DS . 'ErrorException' . EXT, + 'think\exception\DbBindParamException' => CORE_PATH . 'exception' . DS . 'DbBindParamException' . EXT, + 'think\exception\ThrowableError' => CORE_PATH . 'exception' . DS . 'ThrowableError' . EXT, + 'think\File' => CORE_PATH . 'File' . EXT, + 'think\Hook' => CORE_PATH . 'Hook' . EXT, + 'think\Lang' => CORE_PATH . 'Lang' . EXT, + 'think\Log' => CORE_PATH . 'Log' . EXT, + 'think\log\driver\File' => CORE_PATH . 'log' . DS . 'driver' . DS . 'File' . EXT, + 'think\log\driver\Socket' => CORE_PATH . 'log' . DS . 'driver' . DS . 'Socket' . EXT, + 'think\log\driver\Trace' => CORE_PATH . 'log' . DS . 'driver' . DS . 'Trace' . EXT, + 'think\Model' => CORE_PATH . 'Model' . EXT, + 'think\model\Relation' => CORE_PATH . 'model' . DS . 'Relation' . EXT, + 'think\model\Merge' => CORE_PATH . 'model' . DS . 'Merge' . EXT, + 'think\model\Pivot' => CORE_PATH . 'model' . DS . 'Pivot' . EXT, + 'think\Request' => CORE_PATH . 'Request' . EXT, + 'think\Response' => CORE_PATH . 'Response' . EXT, + 'think\response\Json' => CORE_PATH . 'response' . DS . 'Json' . EXT, + 'think\response\Jsonp' => CORE_PATH . 'response' . DS . 'Jsonp' . EXT, + 'think\response\Redirect' => CORE_PATH . 'response' . DS . 'Redirect' . EXT, + 'think\response\View' => CORE_PATH . 'response' . DS . 'View' . EXT, + 'think\response\Xml' => CORE_PATH . 'response' . DS . 'Xml' . EXT, + 'think\Process' => CORE_PATH . 'Process' . EXT, + 'think\paginator\Collection' => CORE_PATH . 'paginator' . DS . 'Collection' . EXT, + 'think\paginator\driver\Bootstrap' => CORE_PATH . 'paginator' . DS . 'driver' . DS . 'Bootstrap' . EXT, + 'think\Route' => CORE_PATH . 'Route' . EXT, + 'think\Session' => CORE_PATH . 'Session' . EXT, + 'think\session\driver\Memcache' => CORE_PATH . 'session' . DS . 'driver' . DS . 'Memcache' . EXT, + 'think\session\driver\Memcached' => CORE_PATH . 'session' . DS . 'driver' . DS . 'Memcached' . EXT, + 'think\session\driver\Redis' => CORE_PATH . 'session' . DS . 'driver' . DS . 'Redis' . EXT, + 'think\Template' => CORE_PATH . 'Template' . EXT, + 'think\template\Taglib' => CORE_PATH . 'template' . DS . 'Taglib' . EXT, + 'think\template\taglib\Cx' => CORE_PATH . 'template' . DS . 'taglib' . DS . 'Cx' . EXT, + 'think\template\driver\File' => CORE_PATH . 'template' . DS . 'driver' . DS . 'File' . EXT, + 'think\Url' => CORE_PATH . 'Url' . EXT, + 'think\Validate' => CORE_PATH . 'Validate' . EXT, + 'think\View' => CORE_PATH . 'View' . EXT, + 'think\view\driver\Think' => CORE_PATH . 'view' . DS . 'driver' . DS . 'Think' . EXT, + 'think\view\driver\Php' => CORE_PATH . 'view' . DS . 'driver' . DS . 'Php' . EXT, + 'traits\controller\Jump' => TRAIT_PATH . 'controller' . DS . 'Jump' . EXT, +]; diff --git a/base.php b/base.php index 7e0cbbe7..00d3c340 100644 --- a/base.php +++ b/base.php @@ -32,7 +32,6 @@ defined('CONF_EXT') or define('CONF_EXT', EXT); // 配置文件后缀 defined('ENV_PREFIX') or define('ENV_PREFIX', 'PHP_'); // 环境变量的配置前缀 defined('IS_API') or define('IS_API', false); // 是否API接口 defined('APP_AUTO_RUN') or define('APP_AUTO_RUN', true); // 是否自动运行 -defined('APP_MODE') or define('APP_MODE', 'common'); // 应用模式 默认为普通模式 // 环境常量 define('IS_CLI', PHP_SAPI == 'cli' ? true : false); diff --git a/mode/common.php b/mode/common.php deleted file mode 100644 index b83e8895..00000000 --- a/mode/common.php +++ /dev/null @@ -1,116 +0,0 @@ - -// +---------------------------------------------------------------------- - -/** - * ThinkPHP 普通模式定义 - */ -return [ - // 命名空间 - 'namespace' => [ - 'think' => LIB_PATH . 'think' . DS, - 'behavior' => LIB_PATH . 'behavior' . DS, - 'traits' => LIB_PATH . 'traits' . DS, - ], - - // 配置文件 - 'config' => THINK_PATH . 'convention' . EXT, - - // 别名定义 - 'alias' => [ - 'think\App' => CORE_PATH . 'App' . EXT, - 'think\Build' => CORE_PATH . 'Build' . EXT, - 'think\Cache' => CORE_PATH . 'Cache' . EXT, - 'think\cache\driver\Apc' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Apc' . EXT, - 'think\cache\driver\File' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'File' . EXT, - 'think\cache\driver\Lite' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Lite' . EXT, - 'think\cache\driver\Memcache' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Memcache' . EXT, - 'think\cache\driver\Memcached' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Memcached' . EXT, - 'think\cache\driver\Redis' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Redis' . EXT, - 'think\cache\driver\Secache' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Secache' . EXT, - 'think\cache\driver\Sqlite' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Sqlite' . EXT, - 'think\cache\driver\Wincache' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Wincache' . EXT, - 'think\cache\driver\Xcache' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Xcache' . EXT, - 'think\Config' => CORE_PATH . 'Config' . EXT, - 'think\config\Ini' => CORE_PATH . 'config' . DS . 'driver' . DS . 'Ini' . EXT, - 'think\config\Json' => CORE_PATH . 'config' . DS . 'driver' . DS . 'Json' . EXT, - 'think\config\Xml' => CORE_PATH . 'config' . DS . 'driver' . DS . 'Xml' . EXT, - 'think\Console' => CORE_PATH . 'Console' . EXT, - 'think\Collection' => CORE_PATH . 'Collection' . EXT, - 'think\Controller' => CORE_PATH . 'Controller' . EXT, - 'think\controller\Hprose' => CORE_PATH . 'controller' . DS . 'Hprose' . EXT, - 'think\controller\Jsonrpc' => CORE_PATH . 'controller' . DS . 'Jsonrpc' . EXT, - 'think\controller\Rest' => CORE_PATH . 'controller' . DS . 'Rest' . EXT, - 'think\controller\Rpc' => CORE_PATH . 'controller' . DS . 'Rpc' . EXT, - 'think\controller\Yar' => CORE_PATH . 'controller' . DS . 'Yar' . EXT, - 'think\Cookie' => CORE_PATH . 'Cookie' . EXT, - 'think\Db' => CORE_PATH . 'Db' . EXT, - 'think\db\Connection' => CORE_PATH . 'db' . DS . 'Connection' . EXT, - 'think\db\connector\Mysql' => CORE_PATH . 'db' . DS . 'connector' . DS . 'Mysql' . EXT, - 'think\db\connector\Oracle' => CORE_PATH . 'db' . DS . 'connector' . DS . 'Oracle' . EXT, - 'think\db\connector\Pgsql' => CORE_PATH . 'db' . DS . 'connector' . DS . 'Pgsql' . EXT, - 'think\db\connector\Sqlite' => CORE_PATH . 'db' . DS . 'connector' . DS . 'Sqlite' . EXT, - 'think\db\connector\Sqlsrv' => CORE_PATH . 'db' . DS . 'connector' . DS . 'Sqlsrv' . EXT, - 'think\db\Builder' => CORE_PATH . 'db' . DS . 'Builder' . EXT, - 'think\db\builder\Mysql' => CORE_PATH . 'db' . DS . 'builder' . DS . 'Mysql' . EXT, - 'think\db\builder\Oracle' => CORE_PATH . 'db' . DS . 'builder' . DS . 'Oracle' . EXT, - 'think\db\builder\Pgsql' => CORE_PATH . 'db' . DS . 'builder' . DS . 'Pgsql' . EXT, - 'think\db\builder\Sqlite' => CORE_PATH . 'db' . DS . 'builder' . DS . 'Sqlite' . EXT, - 'think\db\builder\Sqlsrv' => CORE_PATH . 'db' . DS . 'builder' . DS . 'Sqlsrv' . EXT, - 'think\db\Query' => CORE_PATH . 'db' . DS . 'Query' . EXT, - 'think\Debug' => CORE_PATH . 'Debug' . EXT, - 'think\Error' => CORE_PATH . 'Error' . EXT, - 'think\Exception' => CORE_PATH . 'Exception' . EXT, - 'think\exception\DbException' => CORE_PATH . 'exception' . DS . 'DbException' . EXT, - 'think\exception\Handle' => CORE_PATH . 'exception' . DS . 'Handle' . EXT, - 'think\exception\HttpException' => CORE_PATH . 'exception' . DS . 'HttpException' . EXT, - 'think\exception\HttpResponseException' => CORE_PATH . 'exception' . DS . 'HttpResponseException' . EXT, - 'think\exception\PDOException' => CORE_PATH . 'exception' . DS . 'PDOException' . EXT, - 'think\exception\ErrorException' => CORE_PATH . 'exception' . DS . 'ErrorException' . EXT, - 'think\exception\DbBindParamException' => CORE_PATH . 'exception' . DS . 'DbBindParamException' . EXT, - 'think\exception\ThrowableError' => CORE_PATH . 'exception' . DS . 'ThrowableError' . EXT, - 'think\File' => CORE_PATH . 'File' . EXT, - 'think\Hook' => CORE_PATH . 'Hook' . EXT, - 'think\Lang' => CORE_PATH . 'Lang' . EXT, - 'think\Log' => CORE_PATH . 'Log' . EXT, - 'think\log\driver\File' => CORE_PATH . 'log' . DS . 'driver' . DS . 'File' . EXT, - 'think\log\driver\Socket' => CORE_PATH . 'log' . DS . 'driver' . DS . 'Socket' . EXT, - 'think\log\driver\Trace' => CORE_PATH . 'log' . DS . 'driver' . DS . 'Trace' . EXT, - 'think\Model' => CORE_PATH . 'Model' . EXT, - 'think\model\Relation' => CORE_PATH . 'model' . DS . 'Relation' . EXT, - 'think\model\Merge' => CORE_PATH . 'model' . DS . 'Merge' . EXT, - 'think\model\Pivot' => CORE_PATH . 'model' . DS . 'Pivot' . EXT, - 'think\Request' => CORE_PATH . 'Request' . EXT, - 'think\Response' => CORE_PATH . 'Response' . EXT, - 'think\response\Json' => CORE_PATH . 'response' . DS . 'Json' . EXT, - 'think\response\Jsonp' => CORE_PATH . 'response' . DS . 'Jsonp' . EXT, - 'think\response\Redirect' => CORE_PATH . 'response' . DS . 'Redirect' . EXT, - 'think\response\View' => CORE_PATH . 'response' . DS . 'View' . EXT, - 'think\response\Xml' => CORE_PATH . 'response' . DS . 'Xml' . EXT, - 'think\Process' => CORE_PATH . 'Process' . EXT, - 'think\paginator\Collection' => CORE_PATH . 'paginator' . DS . 'Collection' . EXT, - 'think\paginator\driver\Bootstrap' => CORE_PATH . 'paginator' . DS . 'driver' . DS . 'Bootstrap' . EXT, - 'think\Route' => CORE_PATH . 'Route' . EXT, - 'think\Session' => CORE_PATH . 'Session' . EXT, - 'think\session\driver\Memcache' => CORE_PATH . 'session' . DS . 'driver' . DS . 'Memcache' . EXT, - 'think\session\driver\Memcached' => CORE_PATH . 'session' . DS . 'driver' . DS . 'Memcached' . EXT, - 'think\session\driver\Redis' => CORE_PATH . 'session' . DS . 'driver' . DS . 'Redis' . EXT, - 'think\Template' => CORE_PATH . 'Template' . EXT, - 'think\template\Taglib' => CORE_PATH . 'template' . DS . 'Taglib' . EXT, - 'think\template\taglib\Cx' => CORE_PATH . 'template' . DS . 'taglib' . DS . 'Cx' . EXT, - 'think\template\driver\File' => CORE_PATH . 'template' . DS . 'driver' . DS . 'File' . EXT, - 'think\Url' => CORE_PATH . 'Url' . EXT, - 'think\Validate' => CORE_PATH . 'Validate' . EXT, - 'think\View' => CORE_PATH . 'View' . EXT, - 'think\view\driver\Think' => CORE_PATH . 'view' . DS . 'driver' . DS . 'Think' . EXT, - 'think\view\driver\Php' => CORE_PATH . 'view' . DS . 'driver' . DS . 'Php' . EXT, - 'traits\controller\Jump' => TRAIT_PATH . 'controller' . DS . 'Jump' . EXT, - ], -]; diff --git a/mode/sae.php b/mode/sae.php deleted file mode 100644 index 2cc48004..00000000 --- a/mode/sae.php +++ /dev/null @@ -1,132 +0,0 @@ - -// +---------------------------------------------------------------------- - -/** - * ThinkPHP SAE应用模式定义文件 - */ -return [ - // 命名空间 - 'namespace' => [ - 'think' => LIB_PATH . 'think' . DS, - 'behavior' => LIB_PATH . 'behavior' . DS, - 'traits' => LIB_PATH . 'traits' . DS, - ], - - // 配置文件 - 'config' => array_merge(include THINK_PATH . 'convention' . EXT, [ - /* 数据库设置 */ - 'database' => [ - // 数据库类型 - 'type' => 'mysql', - 'dsn' => '', // - // 服务器地址 - 'hostname' => SAE_MYSQL_HOST_M . ',' . SAE_MYSQL_HOST_S, - // 数据库名 - 'database' => SAE_MYSQL_DB, - // 用户名 - 'username' => SAE_MYSQL_USER, - // 密码 - 'password' => SAE_MYSQL_PASS, - // 端口 - 'hostport' => SAE_MYSQL_PORT, - // 数据库连接参数 - 'params' => [], - // 数据库编码默认采用utf8 - 'charset' => 'utf8', - // 数据库表前缀 - 'prefix' => '', - // 数据库调试模式 - 'debug' => false, - // 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器) - 'deploy' => 1, - // 数据库读写是否分离 主从式有效 - 'rw_separate' => true, - // 读写分离后 主服务器数量 - 'master_num' => 1, - // 指定从服务器序号 - 'slave_no' => '', - ], - 'log' => [ - 'type' => 'Sae', - ], - 'cache' => [ - 'type' => 'Sae', - 'path' => CACHE_PATH, - 'prefix' => '', - 'expire' => 0, - ], - 'file_upload_type' => 'Sae', - 'compile_type' => 'Sae', - ]), - - // 别名定义 - 'alias' => [ - 'think\App' => CORE_PATH . 'App' . EXT, - 'think\Build' => CORE_PATH . 'Build' . EXT, - 'think\Cache' => CORE_PATH . 'Cache' . EXT, - 'think\Config' => CORE_PATH . 'Config' . EXT, - 'think\Console' => CORE_PATH . 'Console' . EXT, - 'think\Collection' => CORE_PATH . 'Collection' . EXT, - 'think\Controller' => CORE_PATH . 'Controller' . EXT, - 'think\Cookie' => CORE_PATH . 'Cookie' . EXT, - 'think\Db' => CORE_PATH . 'Db' . EXT, - 'think\Debug' => CORE_PATH . 'Debug' . EXT, - 'think\Error' => CORE_PATH . 'Error' . EXT, - 'think\Exception' => CORE_PATH . 'Exception' . EXT, - 'think\exception\DbException' => CORE_PATH . 'exception' . DS . 'DbException' . EXT, - 'think\exception\Handle' => CORE_PATH . 'exception' . DS . 'Handle' . EXT, - 'think\exception\HttpException' => CORE_PATH . 'exception' . DS . 'HttpException' . EXT, - 'think\exception\HttpResponseException' => CORE_PATH . 'exception' . DS . 'HttpResponseException' . EXT, - 'think\exception\PDOException' => CORE_PATH . 'exception' . DS . 'PDOException' . EXT, - 'think\exception\ErrorException' => CORE_PATH . 'exception' . DS . 'ErrorException' . EXT, - 'think\exception\DbBindParamException' => CORE_PATH . 'exception' . DS . 'DbBindParamException' . EXT, - 'think\exception\ThrowableError' => CORE_PATH . 'exception' . DS . 'ThrowableError' . EXT, - 'think\File' => CORE_PATH . 'File' . EXT, - 'think\Hook' => CORE_PATH . 'Hook' . EXT, - 'think\Lang' => CORE_PATH . 'Lang' . EXT, - 'think\Log' => CORE_PATH . 'Log' . EXT, - 'think\Model' => CORE_PATH . 'Model' . EXT, - 'think\Paginator' => CORE_PATH . 'Paginator' . EXT, - 'think\model\Relation' => CORE_PATH . 'model' . DS . 'Relation' . EXT, - 'think\model\Merge' => CORE_PATH . 'model' . DS . 'Merge' . EXT, - 'think\model\Pivot' => CORE_PATH . 'model' . DS . 'Pivot' . EXT, - 'think\Process' => CORE_PATH . 'Process' . EXT, - 'think\paginator\Collection' => CORE_PATH . 'paginator' . DS . 'Collection' . EXT, - 'think\paginator\driver\Bootstrap' => CORE_PATH . 'paginator' . DS . 'driver' . DS . 'Bootstrap' . EXT, - 'think\Request' => CORE_PATH . 'Request' . EXT, - 'think\Response' => CORE_PATH . 'Response' . EXT, - 'think\response\Json' => CORE_PATH . 'response' . DS . 'Json' . EXT, - 'think\response\Jsonp' => CORE_PATH . 'response' . DS . 'Jsonp' . EXT, - 'think\response\Redirect' => CORE_PATH . 'response' . DS . 'Redirect' . EXT, - 'think\response\View' => CORE_PATH . 'response' . DS . 'View' . EXT, - 'think\response\Xml' => CORE_PATH . 'response' . DS . 'Xml' . EXT, - 'think\Route' => CORE_PATH . 'Route' . EXT, - 'think\Session' => CORE_PATH . 'Session' . EXT, - 'think\Template' => CORE_PATH . 'Template' . EXT, - 'think\Url' => CORE_PATH . 'Url' . EXT, - 'think\Validate' => CORE_PATH . 'Validate' . EXT, - 'think\View' => CORE_PATH . 'View' . EXT, - 'think\db\Connection' => CORE_PATH . 'db' . DS . 'Connection' . EXT, - 'think\db\connector\Mysql' => CORE_PATH . 'db' . DS . 'connector' . DS . 'Mysql' . EXT, - 'think\db\Builder' => CORE_PATH . 'db' . DS . 'Builder' . EXT, - 'think\db\Builder\Mysql' => CORE_PATH . 'db' . DS . 'builder' . DS . 'Mysql' . EXT, - 'think\db\Query' => CORE_PATH . 'db' . DS . 'Query' . EXT, - 'think\view\driver\Think' => CORE_PATH . 'view' . DS . 'driver' . DS . 'Think' . EXT, - 'think\view\driver\Php' => CORE_PATH . 'view' . DS . 'driver' . DS . 'Php' . EXT, - 'think\template\driver\File' => CORE_PATH . 'template' . DS . 'driver' . DS . 'File' . EXT, - 'think\log\driver\File' => CORE_PATH . 'log' . DS . 'driver' . DS . 'File' . EXT, - 'think\cache\driver\File' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'File' . EXT, - 'think\log\driver\Sae' => CORE_PATH . 'log' . DS . 'driver' . DS . 'Sae' . EXT, - 'think\cache\driver\Sae' => CORE_PATH . 'cache' . DS . 'driver' . DS . 'Sae' . EXT, - 'think\template\driver\Sae' => CORE_PATH . 'template' . DS . 'driver' . DS . 'Sae' . EXT, - ], - -]; diff --git a/start.php b/start.php index b75d94f3..23907dcc 100644 --- a/start.php +++ b/start.php @@ -28,34 +28,24 @@ if (is_file(ROOT_PATH . 'env' . EXT)) { } } -// 加载模式定义文件 -$mode = require MODE_PATH . APP_MODE . EXT; - -// 加载模式命名空间定义 -if (isset($mode['namespace'])) { - Loader::addNamespace($mode['namespace']); -} +// 注册命名空间定义 +Loader::addNamespace([ + 'think' => LIB_PATH . 'think' . DS, + 'behavior' => LIB_PATH . 'behavior' . DS, + 'traits' => LIB_PATH . 'traits' . DS, +]); // 注册自动加载 Loader::register(); -// 加载模式别名定义 -if (isset($mode['alias'])) { - Loader::addMap($mode['alias']); -} +// 加载别名定义 +Loader::addMap(include THINK_PATH . 'alias' . EXT); // 注册错误和异常处理机制 Error::register(); // 加载模式配置文件 -if (isset($mode['config'])) { - is_array($mode['config']) ? Config::set($mode['config']) : Config::load($mode['config']); -} - -// 加载模式行为定义 -if (isset($mode['tags'])) { - Hook::import($mode['tags']); -} +Config::set(include THINK_PATH . 'convention' . EXT); // 是否自动运行 if (APP_AUTO_RUN) { diff --git a/tests/thinkphp/baseTest.php b/tests/thinkphp/baseTest.php index f458f48d..1c066bea 100644 --- a/tests/thinkphp/baseTest.php +++ b/tests/thinkphp/baseTest.php @@ -35,7 +35,6 @@ class baseTest extends \PHPUnit_Framework_TestCase $this->assertNotEmpty(EXT); $this->assertNotEmpty(ENV_PREFIX); $this->assertTrue(is_bool(IS_API)); - $this->assertNotEmpty(APP_MODE); $this->assertTrue(!is_null(IS_WIN)); $this->assertTrue(!is_null(IS_CLI)); }