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

PHP 長文章分頁函數 帶使用方法,不會分割段落,翻頁在底部

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

//echo "頁數:".$PageCount."<br>";
//echo "長度:".$CLength."<br><br><br>";
//strpos() 函數返回字符串在另一個字符串中第一次出現的位置
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>";
}
}

}?>

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

php技術PHP 長文章分頁函數 帶使用方法,不會分割段落,翻頁在底部,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 欧美japanese孕交 | 玖玖爱视频在线观看 | 国产精品第3页 | 91福利在线观看 | 免费播放美女一级毛片 | 国产成人综合日韩精品婷婷九月 | 久草五月天 | 国产成+人+综合+亚洲不卡 | 国产亚洲漂亮白嫩美女在线 | 美女扒开屁股让男人桶视频网站 | 性欧美xxxx视频在线观看 | www.久久99| 五月婷婷在线观看 | 大伊人久久 | 夜夜夜夜夜夜夜猛噜噜噜噜噜噜 | 久久国产大片 | 久草社区 | 色视频在线观看免费 | 国产猛男猛女超爽免费视频 | 真实子伦视频不卡 | 91精品国产免费久久久久久青草 | 在线观看亚洲 | 精品一二三四区 | 在线欧美色 | 在线成人| 美国一级做a爰片性色毛片 美国一区二区三区 | 中文字幕精品一区影音先锋 | 国产 欧美 日产中文 | 久久中文字幕不卡一二区 | 久久逼逼 | 精品天海翼一区二区 | 中文在线第一页 | 一色屋色费精品视频在线看 | 午夜黄色在线观看 | 91短视频在线播放 | 国产亚洲欧美在在线人成 | 黄色网址在线播放 | 国产高清视频在线 | 国产精品麻豆一区二区三区 | 91精品国产91热久久久久福利 | 日韩久久精品一区二区三区 |