forked from top-think/think
-
Notifications
You must be signed in to change notification settings - Fork 0
/
console
38 lines (37 loc) · 1.38 KB
/
console
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env php
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2015 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: yunwuxin <[email protected]>
// +----------------------------------------------------------------------
// 定义项目路径
define('APP_PATH', './application/');
// 定义应用模式为console
define('APP_MODE', 'console');
// 开启调试模式
define('APP_DEBUG', true);
// 关闭应用自动执行
define('APP_AUTO_RUN', false);
// 加载框架引导文件
require './thinkphp/start.php';
// 实例化console
$console = new \think\Console('Think Console', '0.1');
// 读取指令集
if (is_file(APP_PATH . 'command' . EXT)) {
$commands = include APP_PATH . 'command' . EXT;
if (is_array($commands)) {
foreach ($commands as $command) {
if (class_exists($command) && is_subclass_of($command, "\\think\\console\\command\\Command")) {
// 注册指令
$console->add(new $command());
}
}
}
}
// 运行
$console->run();