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