The Yii2 framework uses the method to schedule tasks. the yii2 framework plans tasks _ PHP Tutorial.

Source: Internet
Author: User
The Yii2 framework uses the scheduler method to schedule tasks in the yii2 framework. The Yii2 framework uses the method of scheduler tasks. the yii2 framework scheduler tasks example describes how the Yii2 framework uses scheduler tasks. For your reference, the phpname Yii2 framework uses the method of scheduler tasks and the yii2 framework schedules tasks.

This document describes how to use the Yii2 framework to schedule tasks. We will share this with you for your reference. The details are as follows:

<? Phpnamespace 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 ". $ ;}}

Usage:

Use yii \ console \ Controller;

Run

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

Window:

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.