//一周之内获取的时间范围
$now_time = time(); $total_week =isset($_REQUEST['total_week']) && ($_REQUEST['total_week'] > 0) ? $_REQUEST['total_week'] : 1; $begin = $now_time - $total_week * 7 * 86400; $statDate = date("Y/m/d", $begin); $end = $now_time -($total_week - 1) * 7 * 86400; $endDate = date("Y/m/d", $end); $pageno = isset($_REQUEST['pageno']) && ($_REQUEST['pageno'] > 0) ? $_REQUEST['pageno'] : 1; $pagesize = 10;
Refresh page pagination
//是否已经采集完 if ($pageno < $page_total) { echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'; echo '当前第'.$total_week.'周,第'.$pageno.'页,共'.$page_total.'页'; echo '<script>self.location="?total_week='.$total_week.'&pageno='.($pageno + 1).'";</script>'; exit; } else { if ($total_week > 1) { $next_week = $total_week - 1; } else { echo '<script>self.location="xinshengbl.php";</script>'; echo 'ok'; } echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />'; echo '当前第'.$total_week.'周,第'.$pageno.'页,共'.$page_total.'页'; echo '<script>self.location="?total_week='.$next_week.'&pageno=1";</script>;'; exit; }
return $this->page_array($pagesize,$pageno,$result['goods_list'],0);
Array paging function
/ ** * Array paging function core function array_slice * This function first before using all the data inside the database according to a certain order check out into an array * $ count how many pieces of data per page * $ page of the current first few pages * $ check out array for all array * order 0 - unchanged 1- Reverse order * / public function page_array ($ COUNT, Page $, $ array, $ order) { global $ countpage; # set the global variable $ page = (empty ($ ? page)) '1': $ page; # judge whether the current page is empty if it is empty it means that the first page of $ start = ($ page-1 ) * $ count; # calculated for each starting position paged if ( Order. 1 == $) { $ = array_reverse Array ($ Array); } $ COUNT = totals ($ Array); $ countpage = ceil (totals $ / $ COUNT); calculating the total number of pages # $ pagedata = array (); PageData array_slice = $ ($ Array, Start $, $ COUNT); return $ pagedata; # return query data }