$p = $this->db->query($sql); $p->setFetchMode(PDO::FETCH_ASSOC); $result = $p->fetchAll(); return $result[0]; } } error_reporting(E_ALL ^ E_NOTICE); //接收cid $stationid = $argv[1]; // $stationid = 8; if (!$stationid) { exit; } $date = date('Y-m-d', strtotime('-1 day')); $m = new ActiveUser($stationid); $m->executeall($date); /*$sdate = strtotime('2015-02-28'); $sdate = strtotime('+1 month',$sdate); $sdate = strtotime('-1 day',$sdate); $date = date('Y-m-d',$sdate); echo $date;exit;*/ /*function ExecuteDateArea($stationid,$sdate,$edate){ $sdate = strtotime($sdate); $edate = strtotime($edate); while ($sdate <= $edate) { $m = new ActiveUser($stationid); $date = date('Y-m-d',$sdate); $m -> executeall($date); // $sdate = strtotime('+1 month',$sdate); $sdate = strtotime('+1 day',$sdate); }
function ExecuteDateArea($stationid, $sdate, $edate) { $sdate = strtotime($sdate); $edate = strtotime($edate); while ($sdate <= $edate) { $m = new ActiveUser($stationid); $date = date('Y-m-d', $sdate); $m->executeall($date); $sdate = strtotime('+1 day', $sdate); } }