Home > Backend Development > PHP Tutorial > Yii2 framework uses the method of scheduled tasks, yii2 framework scheduled tasks_PHP tutorial

Yii2 framework uses the method of scheduled tasks, yii2 framework scheduled tasks_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-12 08:50:40
Original
824 people have browsed it

Yii2 framework uses scheduled tasks, yii2 framework scheduled tasks

This article describes the example of Yii2 framework using scheduled tasks. Share it with everyone for your reference, the details are as follows:

<&#63;php
namespace console\controllers;
use yii\console\Controller;
/**
 * Test controller
 */
class TestController extends Controller {
  public function actionIndex() {
    echo "cron service runnning";
  }
  public function actionMail($to) {
    echo "Sending mail to " . $to;
  }
}

Copy after login

Use:

use yii\console\Controller;

Copy after login

Execute

yii test
D:\xampp\htdocs\yii2>d:\xampp\php\php yii test cron service runnning D:\xampp\htdocs\yii2>

Copy after login

Use under window:

D:\xampp\htdocs\yii2>d:\xampp\php\php yii test/mail [--to="hemctest@gmail.com"]
Sending mail to [--to=hemctest@gmail.com]

Copy after login

Readers who are interested in more Yii-related content can check out the special topics on this site: "Introduction to Yii Framework and Summary of Common Techniques", "Summary of Excellent PHP Development Framework", "Basic Tutorial for Getting Started with Smarty Templates", "php Date and Time" Usage Summary", "php object-oriented programming introductory tutorial", "php string (string) usage summary", "php mysql database operation introductory tutorial" and "php common database operation skills summary"

I hope this article will be helpful to everyone’s PHP program design based on the Yii framework.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1133087.htmlTechArticleYii2 framework uses the method of scheduled tasks, yii2 framework planned tasks. This article describes the method of Yii2 framework using planned tasks. Share it with everyone for your reference, the details are as follows: phpname...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
yii2 error connecting to mongodb3.2.4
From 1970-01-01 08:00:00
0
0
0
How to use mongodb to do rbac in yii2
From 1970-01-01 08:00:00
0
0
0
php - yii2-ueditor-widget
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template