Home  >  Article  >  php教程  >  php静态分页基础教程

php静态分页基础教程

WBOY
WBOYOriginal
2016-06-21 09:07:471117browse

基础教程|教程|分页|静态

很长很长的文章在准备生成静态页时,但内容比较长,准备以分页的形式生成静态,如何实现呢?

用PHP举例:
$content就是文章的内容了。[page]是文章内容里的分页符。$id为文章编号。

<table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"> <tr> <td style="WORD-WRAP: break-word" bgcolor="#f3f3f3"> <font style="FONT-WEIGHT: bold; COLOR: #990000">以下是引用片段:</font><br>$carr=explode("[page]",$content); <br>$all=count($carr); <br>for($ii=0;$ii     $pagestr.="<a>".($ii+1)."</a>";//分页 <br>} <br>for ($i=0;$i<all></all>    $pagestr=’’; <br>    $splite_conten=$carr[$i];//分页的内容。 <br>        $mycontent=$splite_conten.$pagestr; <br>    //然后把$mycontent写入静态文件$id-($i+1).html <br>}</td> </tr> </table>



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn