23 Star 90 Fork 25

inhere/php-console

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
alone-app 840 Bytes
一键复制 编辑 原始数据 按行查看 历史
Inhere 提交于 2021-11-29 23:02 +08:00 . style: run code inspect for test example resource
#!/usr/env/php
<?php
/**
* only run a controller.
*/
use Inhere\Console\Application;
use Inhere\Console\Examples\Controller\HomeController;
use Inhere\Console\IO\Input;
use Toolkit\Cli\Color;
define('BASE_PATH', dirname(__DIR__));
require dirname(__DIR__) . '/test/bootstrap.php';
try {
$input = new Input();
$app = new Application([
'debug' => true,
'rootPath' => BASE_PATH,
], $input);
$app->controller('home', HomeController::class);
$subCmd = $input->getCommand();
$result = $app->dispatch('home:' . $subCmd, []);
exit((int)$result);
} catch (Exception $e) {
$message = Color::apply('error', $e->getMessage());
echo sprintf("%s\nFile %s:%d\nTrace:\n%s\n",
$message, $e->getFile(), $e->getLine(), $e->getTraceAsString()
);
}
// can also: see './alone' file
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/inhere/php-console.git
git@gitee.com:inhere/php-console.git
inhere
php-console
php-console
master

搜索帮助