新手提问分页类的一个输出循环显示分页遇到问题,求解?
程序员文章站
2024-02-07 13:18:46
...
类 php class function
total_record=$this->numeric($total_record); $this->page_size=$this->numeric($page_size); $this->current_page=$this->numeric($current_page); $this->page_limit=($this->current_page*$this->page_size)-$this->page_size; $this->page_url=$page_url; if($this->current_pagecurrent_page=1; } if($this->current_pagecurrent_page=0; } $total_page_size = ceil($total_record/$page_size); if($this->total_page_sizetotal_page_size=1; } if($this->current_page>$this->total_page_size){ $this->crrent_page=$this->total_page_size; } $this->page_start=$this->current_page; $this->page_stop=$this->current_page+5; if($this->page_stop>$this->total_page_size){ $this->page_stop=$this->total_page_size; $this->page_start=$this->page_stop-5; } if($this->page_startpage_start=1; if($this->page_stop > $this->total_page_size){ $this->page_stop=$this->total_page_size; } } } private function numeric($id){ if(strlen($id)){ if(!ereg("^[0-9]+$",$id)){ $id=1; } } else{ $id=1; } return $id; } private function page_replace($page){ return str_replace("{page}",$page,$this->page_url); } //首页 private function home(){ if($this->current_page!=1){ return "page_replace(1)." \" title=\" 首页 \">首页\n"; } else{ return "首页"; } } //上一页 private function page_up(){ if($this->current_page != 1){ return "page_replace($this->current_page-1)." \" title=\"上一页\">上一页\n "; } else{ return "上一页"; } } //下一页 private function page_down(){ if($this->current_page!=$this->total_page_size){ return "page_replace($this->current_page+1)." \" title=\"下一页\">下一页 \n"; } else{ return "下一页"; } } //尾页 private function page_end(){ if($this->current_page!=$this->total_page_size){ return "page_replace($this->total_page_size)." \" title=\"尾页\">尾页"; } } public function output($id='page'){ $str = "