PHP code example of yunwuxin / think-cron
1. Go to this page and download the library: Download yunwuxin/think-cron library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yunwuxin / think-cron example snippets
namespace app\task;
use yunwuxin\cron\Task;
class DemoTask extends Task
{
public function configure()
{
$this->daily(); //设置任务的周期,每天执行一次,更多的方法可以查看源代码,都有注释
}
/**
* 执行任务
* @return mixed
*/
protected function execute()
{
//...具体的任务执行
}
}