예제 #1
0
파일: crontab.php 프로젝트: ifa6/crontab
	$str = "Module $module is not compiled into PHP";
}
echo "$str\n";
*/
$c = new Crontab();
$a = array('* * * * *' => 'callback', '*/1 * * * *' => function ($id) {
    print_r(Crontab::info());
});
$b = array('*/2 * * * *' => function ($id) {
    $time = date("Y-m-d H:i:s");
    echo "hello crtontab b {$id}, {$time}!\n";
});
var_dump($c->add($a));
var_dump($c->add($b));
var_dump($c->add($b));
var_dump($c->add($b));
var_dump($c->add($b));
var_dump($c->add($b));
var_dump($c->add("* * * * *", "callback"));
var_dump($c->add("* * * * *", function ($id) {
    $time = date("Y-m-d H:i:s");
    echo "hello crtontab id:{$id}, {$time}!\n";
}));
var_dump($c->info());
$c->run();
function callback($id)
{
    $time = date("Y-m-d H:i:s");
    echo "hello crtontab id:{$id}, {$time}!\n";
    sleep(11);
}