当前位置:网站首页>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
边栏推荐
- 在产业互联网时代,将会凭借大的产业范畴,实现足够多的发展
- Nmap: network detection tool and security / port scanner
- 激动人心,2022开放原子全球开源峰会报名火热开启
- logstash清除sincedb_path上传记录,重传日志数据
- Pbootcms plug-in automatically collects fake original free plug-ins
- 面试必刷算法TOP101之回溯篇 TOP34
- Development trend of Ali Taobao fine sorting model
- 测试/开发程序员的成长路线,全局思考问题的问题......
- Modify the ssh server access port number
- Dynamic programming -- linear DP
猜你喜欢
关于softmax函数的见解
The population logic of the request to read product data on the sap Spartacus home page
The inconsistency between the versions of dynamic library and static library will lead to bugs
IP storage and query in MySQL
DOM introduction
Questions about database: (5) query the barcode, location and reader number of each book in the inventory table
What is the most suitable book for programmers to engage in open source?
The third season of ape table school is about to launch, opening a new vision for developers under the wave of going to sea
Fibonacci number
基于DVWA的文件上传漏洞测试
随机推荐
Zhuhai's waste gas treatment scheme was exposed
Questions about database: (5) query the barcode, location and reader number of each book in the inventory table
ORA-00030
Starting from 1.5, build a micro Service Framework - call chain tracking traceid
JMeter BeanShell的基本用法 一下语法只能在beanshell中使用
Live broadcast system code, custom soft keyboard style: three kinds of switching: letters, numbers and punctuation
Leetcode 208. 实现 Trie (前缀树)
IP storage and query in MySQL
About error 2003 (HY000): can't connect to MySQL server on 'localhost' (10061)
Mysql--- query the top 5 students
Overview of Zhuhai purification laboratory construction details
037 PHP login, registration, message, personal Center Design
Fibonacci number
激动人心,2022开放原子全球开源峰会报名火热开启
vSphere实现虚拟机迁移
Novice entry depth learning | 3-6: optimizer optimizers
程序员成长第九篇:真实项目中的注意事项
Recursive method to realize the insertion operation in binary search tree
JVM_ 15_ Concepts related to garbage collection
Promise