当前位置:网站首页>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
边栏推荐
- How to get the PHP version- How to get the PHP Version?
- 普通人下场全球贸易,新一轮结构性机会浮出水面
- ADS-NPU芯片架构设计的五大挑战
- MCU realizes OTA online upgrade process through UART
- Intensive learning weekly, issue 52: depth cuprl, distspectrl & double deep q-network
- Unity | 实现面部驱动的两种方式
- 视频直播源码,实现本地存储搜索历史记录
- Hcip---ipv6 experiment
- servlet(1)
- 程序员搞开源,读什么书最合适?
猜你喜欢

Finding the nearest common ancestor of binary search tree by recursion

95后CV工程师晒出工资单,狠补了这个,真香...

The population logic of the request to read product data on the sap Spartacus home page

282. Stone consolidation (interval DP)

Loop structure of program (for loop)

测试/开发程序员的成长路线,全局思考问题的问题......

Opinions on softmax function

Fibonacci number

ubantu 查看cudnn和cuda的版本

False breakthroughs in the trend of London Silver
随机推荐
037 PHP login, registration, message, personal Center Design
Recommended areas - ways to explore users' future interests
The detailed page returns to the list and retains the original position of the scroll bar
cf:C. The Third Problem【关于排列这件事】
Hcip---ipv6 experiment
Overview of Zhuhai purification laboratory construction details
1791. Find the central node of the star diagram / 1790 Can two strings be equal by performing string exchange only once
VMware Tools installation error: unable to automatically install vsock driver
logstash清除sincedb_path上传记录,重传日志数据
Who knows how to modify the data type accuracy of the columns in the database table of Damon
Logstash clear sincedb_ Path upload records and retransmit log data
Distributed base theory
Cf:d. insert a progression [about the insert in the array + the nature of absolute value + greedy top-down]
BiShe - College Student Association Management System Based on SSM
Dede collection plug-in free collection release push plug-in
毕设-基于SSM高校学生社团管理系统
Cf:h. maximum and [bit operation practice + K operations + maximum and]
Hundreds of lines of code to implement a JSON parser
Four commonly used techniques for anti aliasing
Finding the nearest common ancestor of binary tree by recursion