return "".$_SERVER['QUERY_STRING'];
}else{
return str_replace("page_id=".$this-page_id(),"",$_SERVER['QUERY_STRING']);
}
}
//总页数
public function page_num() {
if($this-datanum == 0){
return 1;
}else{
return ceil($this-datanum/$this-page_size);
}
}
//数据库查询的偏移量
public function start() {
return ($this-page_id()-1)*$this-page_size;
}
//数据输出
public function sqlquery() {
return $this-sql." limit ".$this-start().",".$this-page_size;
}
//获取当前文件名
private function php_self() {
return $_SERVER['PHP_SELF'];
}
//上一页
private function pre_page() {
if ($this-page_id() == 1) { //页数等于1
return "a href="https://www.04ip.com/post/.$this-php_self()."?page_id=1".$this-url()."上一页/a ";
}elseif ($this-page_id() != 1) { //页数不等于1
return "a href="https://www.04ip.com/post/.$this-php_self()."?page_id=".($this-page_id()-1).$this-url()."上一页/a ";
}
}
//显示分页
private function display_page() {
$display_page = "";
if($this-page_num() = 10){ //小于10页
for ($i=1;$i=$this-page_num();$i++) //循环显示出页面
$display_page .= "a href="https://www.04ip.com/post/.$this-php_self()."?page_id=".$i.$this-url()."".$i."/a ";
return $display_page;
}elseif($this-page_num()10){ //大于10页
if($this-page_id() = 6){
for ($i=1;$i=10;$i++) //循环显示出页面
$display_page .= "a href="https://www.04ip.com/post/.$this-php_self()."?page_id=".$i.$this-url()."".$i."/a ";
return $display_page;
}elseif(($this-page_id()6)($this-page_num()-$this-page_id() = 4)){
for ($i=$this-page_id()-5;$i=$this-page_id()+4;$i++) //循环显示出页面
$display_page .= "a href="https://www.04ip.com/post/.$this-php_self()."?page_id=".$i.$this-url()."".$i."/a ";
return $display_page;
}elseif(($this-page_id()6)($this-page_num()-$this-page_id()4)){
for ($i=$this-page_num()-9;$i=$this-page_num();$i++) //循环显示出页面
$display_page .= "a href="https://www.04ip.com/post/.$this-php_self()."?page_id=".$i.$this-url()."".$i."/a ";
return $display_page;
}
}
}
//下一页
private function next_page() {
if ($this-page_id()$this-page_num()) { //页数小于总页数
return "a href="https://www.04ip.com/post/.$this-php_self()."?page_id=".($this-page_id()+1).$this-url()."下一页/a ";
}elseif ($this-page_id() == $this-page_num()) { //页数等于总页数
return "a href="https://www.04ip.com/post/.$this-php_self()."?page_id=".$this-page_num().$this-url()."下一页/a ";
}
}
// 设置分页信息
public function set_page_info() {
$page_info = "共".$this-datanum."条 ";
$page_info .= "a href="https://www.04ip.com/post/.$this-php_self()."?page_id=1".$this-url()."首页/a ";
$page_info .= $this-pre_page();
$page_info .= $this-display_page();
$page_info .= $this-next_page();
$page_info .= "a href="https://www.04ip.com/post/.$this-php_self()."?page_id=".$this-page_num().$this-url()."尾页/a ";
$page_info .= "第".$this-page_id()."/".$this-page_num()."页";
return $page_info;
}
}
?
2.脚本2:
?php
//类的用法
// 读取分页类
include("pager.class.php");
// 数据库连接初始化
//$db = new mysql();
$impeach_host = '10.81.43.139';
$impeach_usr = 'vmtest15';
$impeach_passwd = 'vmtest15';
$impeach_name = 'ufeature';
$impeach_con = mysql_connect($impeach_host, $impeach_usr, $impeach_passwd) or
die("Can't connect ".mysql_error());
mysql_select_db($impeach_name, $impeach_con);
// 这是一个sql查询语句,并得到查询结果
$sql = "select word from ufeature.spam_accuse_word_list where flag='0'";
推荐阅读
- 灯光直播带货的方法,灯具直播怎么做
- 查看微信公众号运营主体,怎么看微信公众号主体类型
- 手机vip怎么登到电视里,手机端vip 如何登陆到tv端
- 字典函数python 字典函数get
- sapcrm是什么,sap cr dr
- ppt汇怎么赚钱,ppt怎么赚钱外快
- 哪个平台有看越狱直播,什么平台可以看越狱
- Linux命令查看行数 linux 看行数
- python中的floor函数,python中的floor函数怎么用