laravel scheduled task weekly
伊谢尔伦
伊谢尔伦 2017-05-16 16:52:28
0
2
654

In laravel, we see weekly as a scheduled task,

These methods may be combined with additional constraints to create even more finely tuned schedules that only run on certain days of the week. For example, to schedule a command to run weekly on Monday:

$schedule->call(function () { // Runs once a week on Monday at 13:00... })->weekly()->mondays()->at('13:00');

Does this mean that the specific time of the day of the week must be specified?
Or can I use weekly directly?
If I use weekly directly, which day of the week does it start?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all (2)
洪涛

In the Event.php file:

public function weekly() { return $this->cron('0 0 * * 0 *'); }

cron timing is0 0 * * 0 *

minute - an integer from 0 to 59
hour - an integer from 0 to 23
day - an integer from 1 to 31 (must be a valid day in the specified month)
month - an integer from 1 to 12 (or as Jan or Feb abbreviated month)
dayofweek - an integer from 0 to 7, 0 or 7 is used to describe Sunday (or expressed as Sun or Mon abbreviation)
command - the command to be executed (can be used as ls /proc >> /tmp/proc or the command to execute a custom script)

So weekly means execution at 0:00 every Sunday.

    Ty80

    1. Weekly is executed at 0:00 every Sunday by default
    2. You can use itweeklyOn($day, $time = '0:0')
    3. There is no such problem

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!