Table of Contents
Yii2框架使用计划任务的方法,yii2框架计划任务
Home php教程 php手册 Yii2框架使用计划任务的方法,yii2框架计划任务

Yii2框架使用计划任务的方法,yii2框架计划任务

Jun 13, 2016 am 08:38 AM
yii2 Scheduled Tasks

Yii2框架使用计划任务的方法,yii2框架计划任务

本文实例讲述了Yii2框架使用计划任务的方法。分享给大家供大家参考,具体如下:

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

Copy after login

使用:

use yii\console\Controller;

Copy after login

执行

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

Copy after login

window下使用:

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

Copy after login

更多关于Yii相关内容感兴趣的读者可查看本站专题:《Yii框架入门及常用技巧总结》、《php优秀开发框架总结》、《smarty模板入门基础教程》、《php日期与时间用法总结》、《php面向对象程序设计入门教程》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》

希望本文所述对大家基于Yii框架的PHP程序设计有所帮助。

Statement of this Website
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to remove jquery in yii2 How to remove jquery in yii2 Feb 17, 2023 am 09:55 AM

How to remove jquery from yii2: 1. Edit the AppAsset.php file and comment out the "yii\web\YiiAsset" value in the variable $depends; 2. Edit the main.php file and add the configuration "'yii" under the field "components" \web\JqueryAsset' => ['js' => [],'sourcePath' => null,]," to remove the jquery script.

Schedule tasks to specify time points and execute one-time tasks that depend on the atd service Schedule tasks to specify time points and execute one-time tasks that depend on the atd service Mar 11, 2024 am 09:07 AM

The scheduled task is scheduled to execute atat at a specified time point at a time, and the one-time task depends on the atd service. It needs to be started to realize the at task. The at queue is stored in the /var/spool/at directory -V: Display version information -l: List the specified queue Jobs waiting to be run; equivalent to atq-d: delete the specified job; equivalent to atrm-c: view specific job tasks [root@localhost~]#systemctlstartatd[root@localhost~]#systemctlenableatd[root@localhost~]# atnow+1minat>useraddxwzat>#

A few selected CTF exercises will help you learn the yii2 framework! A few selected CTF exercises will help you learn the yii2 framework! Feb 23, 2022 am 10:33 AM

This article will introduce you to the yii2 framework, share a few CTF exercises, and use them to learn the yii2 framework. I hope it will be helpful to everyone.

Timed task and planned task technology in PHP Timed task and planned task technology in PHP May 11, 2023 pm 04:13 PM

With the rapid development of the Internet, more and more websites and applications need to perform some scheduled tasks and planned tasks in the background, such as data cleaning, backup, statistical analysis, etc. As a popular web development language, PHP also provides corresponding scheduled task and planned task technology. This article will introduce the scheduled task and planned task technology in PHP in detail. 1. Concept and usage scenarios of scheduled tasks 1.1 Concept Scheduled tasks refer to automatically executing some specified tasks or operations within a specified time point or time interval. 1.2 make

What is the method to set the scheduled power on and off of Windows 7? What is the method to set the scheduled power on and off of Windows 7? Jul 10, 2023 pm 09:49 PM

Most users don’t know what the scheduled power on and off setting method for windows 7 is. Specifically, win7 can be set to automatically shut down, but users don’t know how to set it up. In fact, it can be set by entering a simple code, and you need to use cmd to set it up. The following is an introduction to the actual Windows 7 timer power on and off setting method. Users can refer to it and set it up, which is very simple. What is the method to set the timer on and off of Windows 7? 1. Set automatic shutdown. In fact, it can only be done from within the capabilities of the system itself, i.e. entering the shutdown command in the action box. Open the menu bar and click Action. If not, just press the shortcut key to open it, win+r to open it. 2. For example, if we want to turn off the power after three hours

How to install Redis extension using YII2 framework How to install Redis extension using YII2 framework May 26, 2023 pm 06:41 PM

1. You need to download the windows version of the master branch of yii2-redis with composer 2. Unzip and copy it to vendor/yiisoft 3. Add 'yiisoft/yii2-redis'=>array('name'=>'yiisoft to extensions.php under yiisoft /yii2-redis','version'=>'2.0.

Laravel development: How to schedule tasks using Laravel Task Scheduling? Laravel development: How to schedule tasks using Laravel Task Scheduling? Jun 13, 2023 pm 02:23 PM

Laravel is a popular PHP framework that provides great support for web application development. One of the powerful and useful features is LaravelTaskScheduling. This article will introduce how to use LaravelTaskScheduling to perform scheduled tasks. 1. What is LaravelTaskScheduling scheduled task? LaravelTaskScheduling is

How to implement scheduled tasks and scheduled tasks through the Webman framework? How to implement scheduled tasks and scheduled tasks through the Webman framework? Jul 08, 2023 am 11:43 AM

How to implement scheduled tasks and scheduled tasks through the Webman framework? Webman is a lightweight web framework developed based on Go language. It provides a simple way to implement scheduled tasks and planned tasks. This article will introduce how to use the Webman framework to implement timed tasks and scheduled tasks, and provide corresponding code examples. Before using the Webman framework, you need to install Webman first. Webman can be installed with the following command: gogetgithub.com/he

See all articles