Home > Article > PHP Framework > How to implement scheduled message push in yii2
Yii2’s scheduled tasks can be written in two ways. The principle is to call them through the server’s scheduled tasks
1. Through Calling the specified URL is equivalent to accessing in the browser (Recommended learning: yii framework)
2. Call through console
Let’s talk about how Console implements scheduled tasks
First create a Controlle and inherit yii\console\Controller;
<?php namespace console\controllers; use yii\console\Controller; class TestController extends Controller { public function actionIndex() { echo "hello world"; } }
The above is the detailed content of How to implement scheduled message push in yii2. For more information, please follow other related articles on the PHP Chinese website!