Home  >  Article  >  Backend Development  >  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

WBOY
WBOYOriginal
2016-07-12 08:50:40753browse

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;
  }
}

Use:

use yii\console\Controller;

Execute

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

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]

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...
Statement:
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