一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

PHP 長(zhǎng)文章分頁函數(shù) 帶使用方法,不會(huì)分割段落,翻頁在底部

復(fù)制代碼 代碼如下:
<?php function ff_page($content,$page)
{
global $expert_id;
$PageLength = 2000; //每頁字?jǐn)?shù)
$CLength = strlen($content);
$PageCount = floor(($CLength / $PageLength)) + 1; //計(jì)算頁數(shù)
$PageArray=array();
$Seperator = array("/n","/r","。","!","?",";",",","”","'"); //分隔符號(hào)

//echo "頁數(shù):".$PageCount."<br>";
//echo "長(zhǎng)度:".$CLength."<br><br><br>";
//strpos() 函數(shù)返回字符串在另一個(gè)字符串中第一次出現(xiàn)的位置
if($CLength<$PageLength)
{
echo $content;

}else{

$PageArray[0]=0;
$Pos = 0;
$i=0;
//第一頁
for($j=0;$j<sizeof($Seperator);$j++)
{
//echo $Seperator[$j];
$Pos=strpos($content,$Seperator[$j],$PageArray[$i]+1900);
while($Pos > 0 && $Pos < ($i+1)*$PageLength && $Pos > $i*$PageLength )
{
$PageArray[$i] = $Pos ;
$Pos = strpos($Pos+$PageLength,$content,$Seperator[$j]) ;
}
if($PageArray[$i]>0)
{
$j = $j + sizeof($Seperator) + 1;
}
}

//---
for($i=1;$i<$PageCount-1;$i++){

for($j=0;$j<sizeof($Seperator);$j++)
{
//echo $Seperator[$j];
$Pos=strpos($content,$Seperator[$j],$PageArray[$i-1]+1900);
while($Pos > 0 && $Pos < ($i+1)*$PageLength && $Pos > $i*$PageLength )
{
$PageArray[$i] = $Pos ;
$Pos = strpos($Pos+$PageLength,$content,$Seperator[$j]) ;
}
if($PageArray[$i]>0)
{
$j = $j + sizeof($Seperator) + 1;
}
}
}


//--最后一頁
$PageArray[$PageCount-1]=$CLength;

//$page=2;
if($page==1)
{
$output=substr($content,0,$PageArray[$page-1]+2);

}
if($page>1 && $page<=$PageCount)
{
$output=substr($content,$PageArray[$page-2]+2,$PageArray[$page-1]-$PageArray[$page-2]);
$output=" (上接第".($page-1)."頁)/n".$output;
}

echo str_replace("/n","<br>   ",$output);
//if($page==$PageCount)
//return $output=substr($content,$PageArray[$page-2]+2,$PageArray[$page-1]-$PageArray[$page-2]);

if($PageCount>1)
{
echo "<br><br><br><center>";
echo "<font color='ff0000'>".$page."</font>/".$PageCount." 頁  ";
if($page>1)
echo "<a href=$php_SELF?expert_id=$expert_id&page_t=".($page-1)."></a> ";
else
echo " ";

for($i=1;$i<=$PageCount;$i++)
{

echo "<a href=$php_SELF?expert_id=$expert_id&page_t=".$i.">[".$i."]</a> ";
}

if($page<$PageCount)
echo " <a href=$php_SELF?expert_id=$expert_id&page_t=".($page+1)."></a> ";
else
echo " ";

echo "</center>";
}
}

}?>

使用
復(fù)制代碼 代碼如下:
<?php
$content1=''測(cè)試文字,盡量長(zhǎng)一些,www.jb51.NET";
$current=$_REQUEST['page_t'];
$result=ff_page($content1,$current);
echo $result;
?>

php技術(shù)PHP 長(zhǎng)文章分頁函數(shù) 帶使用方法,不會(huì)分割段落,翻頁在底部,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 日本人乱人乱亲乱色视频观看 | 91亚洲国产成人久久精品网站 | www.色.con| 在线成人爽a毛片免费软件 在线成人小视频 | 日韩一区国产二区欧美三区 | 五月婷婷在线免费观看 | 99在线国产视频 | 色综合五月婷婷 | 好吊日免费视频 | 国产91边对白在线播放 | 国产熟睡乱子伦视频观看看 | 日本视频www | 国产精品久久久久久福利69堂 | 日韩精品中文字幕一区二区三区 | 久久伊人草 | 精彩视频一区二区三区 | 青青碰 | 午夜免费小视频 | 911国产自产精品a | 国产玖玖在线观看 | 中文字幕第13亚洲另类 | 在线播放一区二区精品产 | 香蕉eeww99国产在线观看 | 狠狠亚洲婷婷综合色香五 | 日本大片免a费观看视频+播放器 | 久久综合九九 | 国产精品高清一区二区三区 | 狠狠干伊人 | 国内精品在线视频 | 天堂成人一区二区三区 | 国产我不卡| 亚洲成在人天堂一区二区 | 日本韩国三级在线 | 99久久伊人 | 日韩在线一区二区三区免费视频 | 色老板最新网址 | 日本人videos18videos在线看 | 亚洲人色大成年网站在线观看 | 91福利国产在线观看网站 | 久草婷婷 | 国产视频第二页 |