中文字幕日韩一区二区_国产一区二区av_国产毛片av_久久久久国产一区_色婷婷电影_国产一区二区精品

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 長文章分頁函數 帶使用方法,不會分割段落,翻頁在底部,轉載需保留來源!

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

主站蜘蛛池模板: 欧美黑人一级爽快片淫片高清 | 91视频在线 | 99精品免费久久久久久久久日本 | 成人福利网站 | 精品欧美一区二区三区久久久小说 | 91九色视频 | 日本精品视频在线观看 | 蜜桃在线视频 | 精品国产乱码久久久久久丨区2区 | 在线免费观看黄网 | 日本特黄a级高清免费大片 成年人黄色小视频 | 亚洲男女激情 | 国产人成在线观看 | 久久中文字幕一区 | 久久天天综合 | 亚洲精品久久久久久久久久久 | 国产伦精品一区二区三区照片91 | 日韩高清国产一区在线 | 国产精品久久久久久av公交车 | 精品一区久久 | 中文字幕av亚洲精品一部二部 | 91精品国产美女在线观看 | 亚洲第一av | 久久国产传媒 | 国产日韩欧美激情 | 在线国产视频 | 欧美精品一区二区三区四区 在线 | 亚洲专区在线 | www.狠狠操| 久久人人国产 | 嫩草91在线| 日韩精品免费看 | 免费观看一级毛片视频 | 国产福利二区 | 免费一区 | 人人干人人玩 | 拍真实国产伦偷精品 | 国产精品免费一区二区三区四区 | 久久久久91 | 国产99久久 | 欧美一级在线免费 |