当前位置:   article > 正文

Lumen框架实现脚本传参_lumen console 参数

lumen console 参数

一、首先编辑命令文件 Test.php

app\Console\Commands\Test\Test.php

<?php


namespace App\Console\Commands\Test;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\App;

class Test extends Command
{
    protected $signature = 'test:test {country}';//命令后面加上参数

    protected $description = 'test:test';

    public function __construct()
    {
        parent::__construct();
    }

    public function handle()
    {
        $country = $this->argument('country');//获取命令参数
        App::make('adminreport.org')->OrgSurveyScript($country);//将参数传入相应的调用方
        return true;
    }
}

二、其次编辑Kernel.php文件

app\Console\Kernel.php

 

<?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{   

         

/**
 * The Artisan commands provided by your application.
 *
 * 
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Gausst松鼠会/article/detail/276428
推荐阅读
相关标签
  

闽ICP备14008679号