💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
[TOC] 新建文件 `App/Command/Test.php` ``` namespace App\Command; use EasySwoole\EasySwoole\Command\CommandInterface; use EasySwoole\EasySwoole\Command\Utility; class Test implements CommandInterface { public function commandName(): string { return 'test'; } public function exec(array $args): ?string { //打印参数,打印测试值 var_dump($args); echo 'test'.PHP_EOL; return null; } public function help(array $args): ?string { //输出logo $logo = Utility::easySwooleLog(); return $logo."this is test"; } } ``` ## 新建 `/bootstrap.php` ``` \EasySwoole\EasySwoole\Command\CommandContainer::getInstance()->set(new \App\Command\Test()); ``` > bootstrap是3.2.5新增的事件,它允许用户在框架初始化之前执行自定义事件 ``` php easyswoole test php easyswoole test 123 123 php easyswoole help test ```