How to create cron job using PHP?

前端 未结 12 1530
一整个雨季
一整个雨季 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 06:02

    why you not use curl? logically, if you execute php file, you will execute that by url on your browser. its very simple if you run curl

    while(true)
    {
        sleep(60); // sleep for 60 sec = 1 minute
    
        $s = curl_init();
        curl_setopt($s,CURLOPT_URL, $your_php_url_to_cron); 
        curl_exec($s); 
        curl_getinfo($s,CURLINFO_HTTP_CODE); 
        curl_close($s);
    }
    

提交回复
热议问题