2015-04-05 75 views

回答

3

如果您使用Laravel 5,這已經集成,如果您使用L4,則可以使用dispacther作爲@pespantelis提供的。

在你提到你可以做到這一點的情況下:

在cron格式:

<?php 
$schedule->command('sendMyEmailCommand')->cron('0 0 15 * *'); 

在更表現Laravel方式:

<?php 
$schedule->command('sendMyEmailCommand')->monthly()->when(function() 
{ 
    return (date("d") == 15); 
}); 

見詳細的相關laravel docs和guiadance。

1

您可以用dispatcher做到這一點。

調度員是Laravel artisan命令調度工具,用於調度項目中的artisan命令,因此在部署時不需要碰觸您的crontab。

相關問題