php 命令行框架,TP框架自定义命令行command基本使用教程案例,ThinkPHP自定义命令行高级进阶使用教程案例...

一、自定义命令行 - 基本使用教程案例

1、建立命令类文件,新建application/index/command/Test.php

// +----------------------------------------------------------------------

// | Title : 自定义命令行类

// +----------------------------------------------------------------------

// | Author: xiaochuan <[email protected]>

// +----------------------------------------------------------------------

// | WebUrl: www.youhutong.com

// +----------------------------------------------------------------------

// | Date  : 2019-01-28

// +----------------------------------------------------------------------

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('test命令');

}

protected function execute(Input $input, Output $output)

{

$output->writeln('Hello World');

}

}

?>

2、配置command.php文件,目录在application/command.php

// +----------------------------------------------------------------------

// | ThinkPHP [ WE CAN DO IT JUST THINK ]

// +---------------------------

你可能感兴趣的:(php,命令行框架)