Laravel task scheduling
習慣沉默
習慣沉默 2017-05-16 16:51:20
0
1
574

Recently, I used Laravel to do scheduled tasks. I wrote a scheduled task that can be executed normally every minute. However, when it is changed to hours, it cannot be executed as expected. It made me confused.

protected function schedule(Schedule $schedule)
    {
        $schedule->call(function () {
            //DB::table('cms_articles')->delete();
            DB::update('update cms_articles set hit=hit + FLOOR(1 + (RAND() * 10)) where hit>1000');
            DB::update('update cms_articles set hit=hit + FLOOR(1 + (RAND() * 20)) where hit<1000');
        })->hourly();
    }
習慣沉默
習慣沉默

reply all(1)
伊谢尔伦

Please paste the specific code

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!