1 _error = '数组不存在';12 return false;13 }14 if($url == ''){15 $this->_error = '域名地址不可缺少';16 return false;17 }18 $this->lists = $lists;19 $this->url = $url;20 $this->arr = $arr;21 $count = count($arr);22 $this->totalPage = ceil($count / $this->lists);23 }24 25 public function getData(){26 $page = empty($_GET['page'])?1:$_GET['page'];27 $start = ($page - 1)*$this->lists;28 //return $this->lists;29 if($this->order == 1){30 $this->arr = array_reverse($this->arr);31 }32 $res = array_slice($this->arr,$start,$this->lists);33 return $res;34 }35 36 public function getShow(){37 $page = empty($_GET['page'])?1:$_GET['page'];38 if($page > 1){39 $prevPage = $page-1;40 }else{41 $prevPage = 1;42 }43 44 if($page < $this->totalPage){45 $nextPage = $page+1;46 }else{47 $page = $this->totalPage;48 }49 $str = ' ';64 return $str;65 }66 67 public function getError(){68 return $this->_error;69 }70 }71 for($i =0;$i<100;$i++){72 $arr[$i] = $i*10;73 }74 $page = new ArrayPage($arr,10,'http://localhost/testSvn/arrayPage.php',0);75 $res = $page->getData();76 echo $page->getShow();