tp5或thinkphp5执⾏shell命令定时执⾏命令⾏运⾏php脚本application\common.php⽂件内容如下:
return [
'app\shell\command\Test',
];
application\shell\command\Test.php内容如下:
namespace app\shell\command;
日内瓦协议use think\console\Command;
国术联盟
use think\console\Input;
use think\console\Output;
use think\Db;
class Test extends Command
苯胺类化合物
{
protected function configure()
{
parent::configure();
$this->setName('Test')->setDescription('Test');
中国传媒
}
protected function execute(Input $input, Output $output)
{
阿托品试验
echo 'TestTestTestTest';exit;
}
}
切换到TP5根⽬录,即../application/上级⽬录(同级有个⽂件think)。
按住Shift键并且右击⿏标,选择‘在此处执⾏shell’。(或者直接cmd切换到该⽬录),执⾏如下命令:
F:\x\www\PHPTutorial\php\php-5.6. .\think Test
注:Test与下⾯的名称必须⼀致