Yii2框架使用計劃任務(wù)的方法
本文實例講述了Yii2框架使用計劃任務(wù)的方法。分享給大家供大家參考,具體如下:
<?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;
}
}
使用:
use yii\console\Controller;
執(zhí)行
yii test D:\xampp\htdocs\yii2>d:\xampp\php\php yii test cron service runnning D:\xampp\htdocs\yii2>
window下使用:
D:\xampp\htdocs\yii2>d:\xampp\php\php yii test/mail [--to="hemctest@gmail.com"] Sending mail to [--to=hemctest@gmail.com]
更多關(guān)于Yii相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Yii框架入門及常用技巧總結(jié)》、《php優(yōu)秀開發(fā)框架總結(jié)》、《smarty模板入門基礎(chǔ)教程》、《php日期與時間用法總結(jié)》、《php面向?qū)ο蟪绦蛟O(shè)計入門教程》、《php字符串(string)用法總結(jié)》、《php+mysql數(shù)據(jù)庫操作入門教程》及《php常見數(shù)據(jù)庫操作技巧匯總》
希望本文所述對大家基于Yii框架的PHP程序設(shè)計有所幫助。
相關(guān)文章
使用PHP+AJAX讓WordPress動態(tài)加載文章的教程
這篇文章主要介紹了使用PHP+AJAX讓WordPress動態(tài)加載文章的教程,即不用手動刷新瀏覽器頁面即可讓加載好的文章顯示,需要的朋友可以參考下2015-12-12
php+memcache實現(xiàn)的網(wǎng)站在線人數(shù)統(tǒng)計代碼
這篇文章主要介紹了php+memcache實現(xiàn)的網(wǎng)站在線人數(shù)統(tǒng)計代碼,代碼例子簡潔實用,需要的朋友可以參考下2014-07-07

