首页›MVC 核心›CliCore
CliCore
Kuoqi\Core\CliCore 是 CLI 模式核心(112 行):命令解析与执行
本页内容
- running 流程
- 命令解析规则
- console 输出
running 流程
CliCore::running() 与 WebCore 同构:先 __initCommonConfig()(应用级 function/config,不含 routes),再 __initInput() 解析命令行。
命令解析规则
| # | 步骤 | 说明 |
|---|---|---|
| 1 | 取 argv | $_SERVER["argv"],shift 掉脚本名 |
| 2 | 转下划线 | snakeHump2code(命令名),如 ctladminCreate → ctladmin_create |
| 3 | 拼类名 | 按 _ 分段 snakeCode2hump 转大驼峰,拼 \Kuoqi\Core\Cli\{段}... |
| 4 | 实例化 | classExists 检查,new 后 input($inputs) + start() |
| 5 | 不存在 | 记 error 日志并输出 toHelper() 帮助清单 |
命令命名示例
// 命令 → 类 php index.php clear → \Kuoqi\Core\Cli\Clear php index.php modelCreate → \Kuoqi\Core\Cli\Model\Create php index.php ctladminCreate → \Kuoqi\Core\Cli\Ctladmin\Create php index.php tablePerfect → \Kuoqi\Core\Cli\Table\Perfect php index.php webServer → \Kuoqi\Core\Cli\Web\Server
console 输出
console($text) 输出 [Y-m-d H:i:s][内存] 内容 格式到终端。
KuoqiPHP v1.05 · 离线静态文档 · 界面基于 KuoqiUI ·
返回首页