1、配置command.php文件,目录在application/command.php 2、建立命令类文件,新建application/index/command/Test.php <?php namespace app\index\command; use think\console\Command; use think\console\Input; use think\console\Output; class Test extends Command { protected function configure() { $this->setName('test')->setDescription('Here is the remark '); } protected function execute(Input $input, Output $output) { $output->writeln("TestCommand:"); } } 3、命令行下运行php think test ,将输出 TestCommand:,说明命令行已经成功
4在command.php文件写return ['app\index\command\remark'];
5脚本内容
// Path=写路径
// cd $Path
// php think remark
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。