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]