本文整理匯總了PHP中cron::run方法的典型用法代碼示例。如果您正苦於以下問題:PHP cron::run方法的具體用法?PHP cron::run怎麽用?PHP cron::run使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cron
的用法示例。
在下文中一共展示了cron::run方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: RunCron
/**
* 執行一個計劃任務
*
* @param 計劃任務文件
* @param 計劃任務名稱
* @return bool 執行成功true,否則false
*/
function RunCron($file, $name)
{
return cron::run($file, $name);
}
示例2: cron
<?php
ini_set('max_execution_time', 600); //600 seconds = 10 minutes
$cron = new cron();
$cron->domain_id=1;
$message = $cron->run();
try
{
//json
//header('Content-type: application/json');
//echo encode::json( $message, 'pretty' );
//xml
ob_end_clean();
header('Content-type: application/xml');
echo encode::xml( $message );
}
catch (Exception $e)
{
echo $e->getMessage();
}
示例3: msg
if ((empty($_REQUEST['pw']) || $_REQUEST['pw'] != $cron_pw) && (empty($cmd_pw) || $cmd_pw['pw'] != $cron_pw)) {
msg('計劃任務執行失敗:密碼錯誤<br/><br/>你需要通過訪問 <b>do.php?pw=密碼</b> 才能執行計劃任務', false);
}
}
if (isset($_GET['in_thread'])) {
define('SYSTEM_CRON_THREAD', true);
}
doAction('cron_1');
if (SYSTEM_PAGE == 'runcron') {
$cron = isset($_GET['cron']) ? sqladds(strip_tags($_GET['cron'])) : msg('運行失敗:計劃任務未指定');
$cpw = option::get('cron_pw');
$x = $m->once_fetch_array("SELECT * FROM `" . DB_PREFIX . "cron` WHERE `name` = '{$cron}';");
if (empty($x['id'])) {
msg('運行失敗:此計劃任務不存在');
}
$log = cron::run($x['file'], $x['name']);
if ($x['freq'] == '-1') {
cron::del($x['name']);
} else {
cron::aset($x['name'], array('lastdo' => time(), 'log' => $log));
}
} else {
$sign_multith = option::get('sign_multith');
if (!isset($_GET['donnot_sign_multith']) && !empty($sign_multith) && function_exists('fsockopen')) {
for ($ii = 0; $ii < $sign_multith; $ii++) {
sendRequest(SYSTEM_URL . 'do.php?donnot_sign_multith&in_thread&pw=' . $cron_pw);
}
}
$return = '';
if (option::get('cron_last_do_time') != $today) {
option::set('cron_last_do_time', $today);
示例4: doAction
case 'admin:cron':
doAction('cron_setting_1');
if (!empty($_GET['act'])) {
cron::aset($_GET['act'], array('no' => 0));
} elseif (!empty($_GET['dis'])) {
cron::aset($_GET['dis'], array('no' => 1));
} elseif (isset($_GET['uninst'])) {
cron::del($_GET['uninst']);
} elseif (isset($_GET['add'])) {
if (stripos($_POST['file'], 'do.php') !== false) {
msg('<h4>請不要將do.php加入到雲簽的計劃任務中來</h4>若需簽到,請用雲監控監控<br/>' . SYSTEM_URL . 'do.php<br/>即可實現計劃任務(cron)的效果<br/><br/>推薦雲監控:<a href="http://www.aliyun.com/product/jiankong/" target="_blank">阿裏雲監控</a> 或 <a href="http://jk.cloud.360.cn/" target="_blank">360網站服務監控</a> 或 <a href="http://ce.baidu.com/" target="_blank">百度雲觀測</a><br/>如果你的服務器在國外且國內訪問較慢,則推薦使用:<a href="http://www.mywebcron.com/" target="_blank">Free Web Cron Service </a>', SYSTEM_URL . 'index.php?mod=admin:cron');
} else {
cron::set($_POST['name'], $_POST['file'], $_POST['no'], $_POST['status'], $_POST['freq'], $_POST['lastdo'], $_POST['log']);
}
} elseif (isset($_GET['run'])) {
$return = cron::run($_GET['file'], $_GET['run']);
cron::aset($_GET['run'], array('lastdo' => time(), 'log' => $return));
} elseif (isset($_GET['xorder'])) {
foreach ($_POST['order'] as $key => $value) {
cron::aset($key, array('orde' => $value));
}
}
doAction('cron_setting_2');
Redirect('index.php?mod=admin:cron&ok');
break;
case 'admin:update:back':
if (isset($_GET['del'])) {
if (file_exists(SYSTEM_ROOT . '/setup/update_backup/' . $_GET['del'])) {
DeleteFile(SYSTEM_ROOT . '/setup/update_backup/' . $_GET['del']);
}
Redirect('index.php?mod=admin:update:back&ok');
示例5: cron
}
$jsonrpc->makeSuccess(utils::o2a($object));
}
if ($jsonrpc->getMethod() == 'object::full') {
$cache = cache::byKey('api::object::full');
$cron = cron::byClassAndFunction('object', 'fullData');
if (!is_object($cron)) {
$cron = new cron();
}
$cron->setClass('object');
$cron->setFunction('fullData');
$cron->setSchedule('* * * * * 2000');
$cron->setTimeout(10);
$cron->save();
if (!$cron->running()) {
$cron->run(true);
}
if ($cache->getValue() != '') {
$jsonrpc->makeSuccess(json_decode($cache->getValue(), true));
}
$jsonrpc->makeSuccess(array());
}
if ($jsonrpc->getMethod() == 'object::fullById') {
$object = object::byId($params['id']);
if (!is_object($object)) {
throw new Exception('Objet introuvable : ' . $params['id'], -32601);
}
$return = utils::o2a($object);
$return['eqLogics'] = array();
foreach ($object->getEqLogic() as $eqLogic) {
$eqLogic_return = utils::o2a($eqLogic);