家庭管理配置系统
在管理面板cronsetting页面中,检查
强制运行
function hello_cronapi($op, $job = NULL){
$items['example_sendmail_cron'] = array(
'description' => 'Send mail with news',
'rule' => '* * * * *', // Every 5 minutes
);
$items['example_news_cron'] = array(
'description' => 'Send mail with news',
'rule' => '*/15 * * * *', // Every 5 minutes
// i must call: example_news_fetch('all')
'callback' => 'example_news_cron',
'arguments' => array('all'),
);
return $items;
}
函数示例_sendmail\u cron(){
echo "Company";
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $txt, FILE_APPEND | LOCK_EX);
$txt = "Jane Doe\n";
fwrite($myfile, $txt, FILE_APPEND | LOCK_EX);
fclose($myfile);
exit;
}
function example_news_cron() {
echo "Company";
$myfile = fopen("newfile2.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $txt, FILE_APPEND | LOCK_EX);
$txt = "Jane Doe\n";
fwrite($myfile, $txt, FILE_APPEND | LOCK_EX);
fclose($myfile);
exit;
}
在上面的cronjob中,创建一个文件并将内容放入该文件中。但文件不是创建的