LoginSignup
1
1

More than 5 years have passed since last update.

Cronの文法確認をPHPでする感じなメモ

Posted at

Laravel5 系で定期実行でcronの設定がかけるけど、文法が合ってるか確認する方法的な。

$ php artisan tinker
Psy Shell v0.7.0 (PHP 5.5.30  cli) by Justin Hileman
>>> \Cron\CronExpression::factory('1 9,12,15,18 * * * *')->isDue( '2016-03-01 09:01:00' );
=> true
>>> \Cron\CronExpression::factory('1 9,12,15,18 * * * *')->isDue( '2016-03-01 09:01:10' );
=> true
>>> \Cron\CronExpression::factory('1 9,12,15,18 * * * *')->isDue( '2016-03-01 09:02:10' );
=> false
>>> 
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1