How to create cron job using PHP?

前端 未结 12 1546
一整个雨季
一整个雨季 2020-11-21 05:50

I\'m new to using cron job. I don\'t even know how to write it. I have tried to search from internet, but I still don\'t understand it well. I want to create a cron job that

12条回答
  •  一个人的身影
    2020-11-21 05:59

    function _cron_exe($schedules) {
            if ($obj->get_option('cronenabledisable') == "yes") {
                // $interval = 1*20;
                $interval = $obj->get_option('cronhowtime');
                if ($obj->get_option('crontiming') == 'minutes') {
                    $interval = $interval * 60;
                } else if ($obj->get_option('crontiming') == 'hours') {
                    $interval = $interval * 3600;
                } else if ($obj->get_option('crontiming') == 'days') {
                    $interval = $interval * 86400;
                }
                $schedules['hourlys'] = array(
                    'interval' => $interval,
                    'display' => 'cronjob'
                );
                return $schedules;
            }
    
    }
    

提交回复
热议问题