tp5&cli模式

作用:
有些费时的功能为避免超时超时而使用cli模式
or
定时任务使用cli模式

步骤:
1:项目根目录/application/command.php ,新增配置'appapicommandDx'
2:在'appapicommandDx' 文件里:

<?php
/**
 * Created by : YqCrm
 * User: lws
 * Date: 2020/7/6
 * Time: 9:35
 */

namespace appapicommand;
use thinkconsoleCommand;
use thinkconsoleInput;
use thinkconsoleOutput;

class Dx extends Command
{
    protected function configure()
    {
        // 绑定cli操作名
        $this->setName('dx')->setDescription('Here is the remark ');
    }
 
    protected function execute(Input $input, Output $output)
    {
      $output->writeln("helloword");
    }

}

在项目/目录,使用命令php think dx即可

原文地址:https://www.cnblogs.com/cl94/p/13383910.html