Home  >  Article  >  PHP Framework  >  How to implement scheduled message push in yii2

How to implement scheduled message push in yii2

(*-*)浩
(*-*)浩Original
2019-12-14 10:04:252490browse

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

How to implement scheduled message push in yii2

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!

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