亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Laravel中任務(wù)調(diào)度console使用方法小結(jié)

 更新時(shí)間:2017年05月07日 11:36:03   作者:編程老頭  
這篇文章主要給大家簡單介紹了Laravel中任務(wù)調(diào)度console使用方法,并附上一個(gè)簡單的示例,希望對大家學(xué)習(xí)使用console能夠有所幫助

適用場景:分析數(shù)據(jù)(日志)

php artisan make:console 你的命令類名

示例:

php artisan make:console Check

在\app\Console\Commands目錄下已生成一個(gè)Check.php文件

<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class Check extends Command
{
  /**
   * The name and signature of the console command.
   *
   * @var string
   */
  protected $signature = 'command:name';

  /**
   * The console command description.
   *
   * @var string
   */
  protected $description = 'Command description';

  /**
   * Create a new command instance.
   *
   * @return void
   */
  public function __construct()
  {
    parent::__construct();
  }

  /**
   * Execute the console command.
   *
   * @return mixed
   */
  public function handle()
  {
    //
  }
}

你可以把$signature改為你要的命令名稱

protected $signature = 'check';

此時(shí)還不能在控制臺(tái)中調(diào)用,需要在Kernel.php中注冊。

protected $commands = [
    'App\Console\Commands\Check'
];

你已經(jīng)可以在控制臺(tái)中使用這個(gè)命令了

php artisan check

點(diǎn)評:似乎也沒啥用,因?yàn)閜hp本身也可以不用Laravel框架來使用CLI命令行。

相關(guān)文章

最新評論