当前位置:网站首页>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
边栏推荐
- C language programming (Chapter 6 functions)
- 面试必刷算法TOP101之回溯篇 TOP34
- Development trend of Ali Taobao fine sorting model
- 可恢复保险丝特性测试
- The third season of ape table school is about to launch, opening a new vision for developers under the wave of going to sea
- The population logic of the request to read product data on the sap Spartacus home page
- Dede collection plug-in free collection release push plug-in
- 毕设-基于SSM高校学生社团管理系统
- [Arduino syntax - structure]
- Kotlin core programming - algebraic data types and pattern matching (3)
猜你喜欢

Four dimensional matrix, flip (including mirror image), rotation, world coordinates and local coordinates
![[pat (basic level) practice] - [simple mathematics] 1062 simplest fraction](/img/b4/3d46a33fa780e5fb32bbfe5ab26a7f.jpg)
[pat (basic level) practice] - [simple mathematics] 1062 simplest fraction

1791. Find the central node of the star diagram / 1790 Can two strings be equal by performing string exchange only once

VSphere implements virtual machine migration

Four commonly used techniques for anti aliasing

Test de vulnérabilité de téléchargement de fichiers basé sur dvwa

282. Stone consolidation (interval DP)

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

Opinions on softmax function

MobileNet系列(5):使用pytorch搭建MobileNetV3并基于迁移学习训练
随机推荐
Obstacle detection
Finding the nearest common ancestor of binary search tree by recursion
程序员成长第九篇:真实项目中的注意事项
The third season of ape table school is about to launch, opening a new vision for developers under the wave of going to sea
Mysql--- query the top 5 students
【第30天】给定一个整数 n ,求它的因数之和
General operation method of spot Silver
什么是弱引用?es6中有哪些弱引用数据类型?js中的弱引用是什么?
Dede collection plug-in free collection release push plug-in
Cglib dynamic agent -- example / principle
关于softmax函数的见解
What is the most suitable book for programmers to engage in open source?
cf:C. The Third Problem【关于排列这件事】
Xunrui CMS plug-in automatically collects fake original free plug-ins
The basic usage of JMeter BeanShell. The following syntax can only be used in BeanShell
新手入门深度学习 | 3-6:优化器optimizers
servlet(1)
SCM Chinese data distribution
SSH login is stuck and disconnected
Leetcode study - day 35