国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > PHP > 正文

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

2024-05-04 23:57:09
字體:
供稿:網(wǎng)友

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

php artisan make:console 你的命令類名

示例:

php artisan make:console Check

在/app/Console/Commands目錄下已生成一個Check.php文件

<?phpnamespace 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';

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

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

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

php artisan check

點評:似乎也沒啥用,因為php本身也可以不用Laravel框架來使用CLI命令行。

 

注:相關(guān)教程知識閱讀請移步到PHP教程頻道。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 休宁县| 蒙山县| 临沂市| 嵊州市| 齐河县| 大化| 文化| 彰武县| 章丘市| 余江县| 台前县| 长岭县| 屏边| 峡江县| 康乐县| 临汾市| 仪陇县| 基隆市| 康保县| 嵊州市| 阿拉尔市| 时尚| 姚安县| 织金县| 曲阜市| 云霄县| 万全县| 大丰市| 丹凤县| 德安县| 沅陵县| 桃园县| 勐海县| 罗定市| 永登县| 灌南县| 阳东县| 长寿区| 青州市| 大关县| 广昌县|