function show_msg() { $group1 = array("张怡", "李丽", "卢秋英", "张培"); $group2 = array("吴昊", "朱丹阳", "李红艳"); $group1_date_str = "2014-02-12 14:00:00"; $timestamp1 = strtotime($group1_date_str); $cur_time = time(); $msg = ""; for ($i = -2; $i < 100; $i++) { $timestamp = $timestamp1 + $i * 2 * 7 * 24 * 60 * 60; if ($timestamp - $cur_time > 0) { if ($i % 2 == 0) { $msg = "本次分享人:" . implode(" ", $group1); } else { $msg = "本次分享人:" . implode(" ", $group2); } break; } } $secLeft = $timestamp - $cur_time; $msg = $msg . ", 分享时间: " . date("Y-m-d 14:00:00", $timestamp) . ", 还剩" . get_readable_time($secLeft); echo "<font color='green'>{$msg}</font>"; }
{ switch ($t) { case 3600: return 'hourly'; case 3600 * 24: return 'daily'; case 3600 * 24 * 7: return 'weekly'; case 3600 * 24 * 30: return 'monthly'; default: return $t . 's'; } } $i = 0; foreach ($res as $r) { $crons[$i]['cron_name'] = $r['cron_name']; $crons[$i]['cron_type'] = $r['cron_type']; $crons[$i]['cron_interval'] = get_readable_time($r['cron_interval']); $crons[$i]['cron_started'] = \CODOF\Time::get_pretty_time($r['cron_started']); $crons[$i]['cron_last_run'] = \CODOF\Time::get_pretty_time($r['cron_last_run']); if ($r['cron_status'] == 0) { $crons[$i]['cron_status'] = 'not running'; } else { $crons[$i]['cron_status'] = '<span style="color:green">running</span>'; } $i++; } CODOF\Util::get_config($db); $smarty->assign('crons', $crons); $content = $smarty->fetch('system/cron.tpl');