2016-11-24 21 views

回答

0

先在自己的項目

folder/console/controllers/CronController.php

<?php 
namespace console\controllers; 
use yii\console\Controller; 
use Yii; 
use common\models\Appoinment; 

class CronController extends Controller { 
    public function actionExpire() 
    { 
     $expireDate=date('Y-m-d', strtotime("+3 days"));// current date plus how many days 
     // yor code select email to all those registered 
     $post = Yii::$app->db->createCommand('SELECT * FROM post WHERE date=:id') 
     ->bindValue(':id',$expireDate) 
     ->queryAll(); 
    } 
} 
?> 

自定義查詢您的表,並設置郵件發送function.After是設置cron作業此鏈接幫助創建CronController.php用於設置cron作業yii2 cron

相關問題