当前位置:网站首页>laravel+宝塔计划任务
laravel+宝塔计划任务
2022-06-22 19:26:00 【香橙战宝橙留香】
先在本地执行php artisan make:command job
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class job 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 int
*/
public function handle()//要执行的任务
{
DB::table('home')->where('id',1)->increment('num',1);
}
}
<?php
namespace App\Console;
use App\Console\Commands\job;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command(job::class)->everyMinute();//调用执行的任务
}
/**
* Register the commands for the application.
*
* @return void
*/
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
将项目上传上传到宝塔
填写计划任务

边栏推荐
- 【已解决】--go_out: protoc-gen-go: Plugin failed with status code 1.
- 智能計算之神經網絡(BP)介紹
- 71-对2010年阿里一道Oracle DBA面试题目的分析
- 慕课5、服务发现-Nacos
- what? You can't be separated by wechat
- How to consider the arrangement of complete knapsack
- R语言penguins数据集可视化
- 讲真,Kotlin 协程的挂起没那么神秘(原理篇)
- 智能计算之神经网络(Hopfield网络-DHNN,CHNN )介绍
- Precautions for Apollo use
猜你喜欢

ROS from entry to mastery (VIII) common sensors and message data

How to consider the arrangement of complete knapsack

6月第3周B站榜单丨飞瓜数据UP主成长排行榜(哔哩哔哩平台)发布!

Software testing - Test Case Design & detailed explanation of test classification

迅睿CMS 自定义数据接口-php执行文件代码

Multi transactions in redis

一文搞懂 MySQL 中 like 的索引情况

R语言AirPassengers数据集可视化

Ribbon load balancing

Introduction of Neural Network (BP) in Intelligent Computing
随机推荐
Several common MySQL commands
74-这类SQL优化,oracle输给了mysql,如何补救?
【奇葩需求之记录对象不同的日志】
Possible security vulnerabilities in NFT
Code to Image Converter | 代码生成漂亮图片工具
【Proteus仿真】三极管组成的H桥驱动直流电机+按键正反转控制
Easyclick fixed status log window
70-根因分析-oracle数据库突发性能问题,谁来背这个锅
Scheduling with Testing
[deeply understand tcapulusdb technology] create a game area for document acceptance
【513. 找树左下角的值】
Introduction to JWT
He was in '98. I can't play with him
树莓派环境设置
[proteus simulation] 8x8LED dot matrix digital cyclic display
Stochastic Adaptive Dynamics of a Simple Market as a Non-Stationary Multi-Armed Bandit Problem
迅睿CMS 自定义数据接口-php执行文件代码
让知识付费系统视频支持M3U8格式播放的方法
One picture decoding opencloudos community open day
Software testing - Test Case Design & detailed explanation of test classification