当前位置:网站首页>Yii console method call, Yii console scheduled task
Yii console method call, Yii console scheduled task
2022-07-06 01:15:00 【gusijin】
yii Except for building Web The rich functionality of the application ,Yii There is also a console with rich functions , They are mainly used to create the tasks of website background processing .
The structure of the console application is very similar to Yii One of the Web Applications . It consists of one or more yii\console\Controller Class composition , They are often called “ command ”. Each controller can also have one or more actions , It's like web controller .
You can run yii Script , Run it in the base directory located in the warehouse .
1、 Scheduled task writing
download Yii After the framework , You can see that there is a console Catalog , There is a complete directory structure : The configuration file 、 controller 、 Model, etc
2、 newly build TestController.php file
<?php
namespace console\controllers;
use yii\console\Controller;
class TestController extends Controller
{
/** * @var Parameters received */
public $param;
// Specify parameters for the console
public function options($actionID)
{
return [
'param',
];
}
/** * @name Script */
public function actionDo()
{
echo $this->param.PHP_EOL;
}
}
3、 function php yii test/do
usage
You can use the following syntax to perform console controller actions :
php yii [ --option1=value1 --option2=value2 … argument1 argument2 … ]
php yii test/do --param=123
Show :123
边栏推荐
- Illustrated network: the principle behind TCP three-time handshake, why can't two-time handshake?
- Five challenges of ads-npu chip architecture design
- Condition and AQS principle
- Cannot resolve symbol error
- After 95, the CV engineer posted the payroll and made up this. It's really fragrant
- JMeter BeanShell的基本用法 一下语法只能在beanshell中使用
- Recoverable fuse characteristic test
- Pbootcms plug-in automatically collects fake original free plug-ins
- Tcpdump: monitor network traffic
- Finding the nearest common ancestor of binary search tree by recursion
猜你喜欢
Beginner redis
JVM_ 15_ Concepts related to garbage collection
How to extract MP3 audio from MP4 video files?
Some features of ECMAScript
程序员搞开源,读什么书最合适?
MCU通过UART实现OTA在线升级流程
cf:D. Insert a Progression【关于数组中的插入 + 绝对值的性质 + 贪心一头一尾最值】
Exciting, 2022 open atom global open source summit registration is hot
I'm interested in watching Tiktok live beyond concert
Cve-2017-11882 reappearance
随机推荐
DD's command
Condition and AQS principle
Finding the nearest common ancestor of binary tree by recursion
Remember that a version of @nestjs/typeorm^8.1.4 cannot be obtained Env option problem
logstash清除sincedb_path上传记录,重传日志数据
伦敦银走势中的假突破
激动人心,2022开放原子全球开源峰会报名火热开启
Dede collection plug-in free collection release push plug-in
电气数据|IEEE118(含风能太阳能)
Opinions on softmax function
The basic usage of JMeter BeanShell. The following syntax can only be used in BeanShell
Recursive method converts ordered array into binary search tree
Cf:h. maximum and [bit operation practice + K operations + maximum and]
JVM_ 15_ Concepts related to garbage collection
Exciting, 2022 open atom global open source summit registration is hot
MobileNet系列(5):使用pytorch搭建MobileNetV3并基于迁移学习训练
C language programming (Chapter 6 functions)
[Arduino syntax - structure]
Gartner released the prediction of eight major network security trends from 2022 to 2023. Zero trust is the starting point and regulations cover a wider range
关于softmax函数的见解