用了fck编辑器的分页功能
 $split ='<div style="page-break-after: always"><span style="display: none">&nbsp;</span></div>';
 $array =explode($split,$row[content]);
在本地可以进行分页,为什么上传到空间后,就分不了了呢?

解决方案 »

  1.   

    <?php
    header("Content-Type: text/html; charset=gb2312"); include("conn.php");
    ?>
    <table width="700"  border="0" align="center" cellpadding="10" cellspacing="1" bgcolor="#add3ef" >
    <?php
    $title=$_GET[title];
    $content="select content from add_art where title='$title'";
    $query=mysql_query($content);
    $row=mysql_fetch_array($query);
    ?><tr><td>
    <?php
    echo"<table align=center><tr><td>$title</td></tr></table>";
    echo"<br>";
    echo"&nbsp;&nbsp;";
     $page =isset($_GET['page'])?$_GET['page']:1;//这里了得当前文章的分页编号如果没有就为1
     $split ='<div style="page-break-after: always"><span style="display: none">&nbsp;</span></div>';//这里是fckeditor文章的分页代码
     $array =explode($split,$row[content]);
     if($page>sizeof($array) ){//判断从地址栏获得的分页编号是不是大于总分页的长度,如果是就输出第一页的内容
      echo $array[0];
     }else{
      echo $array[$page-1];//不是就输出$page-1这里因为php函数的下标是从0开始的
     }
     if(sizeof($array)>1){ //这里是判断如果文章没有分页就不显示第N页,
      for($i=1;$i<=sizeof($array);$i++){
       echo "<a href=?title=$title&page=".$i.">[第".$i."页]</a>&nbsp;";
      }
     }?>
    </td></tr>
    </table>总的代码