您现在的位置是:首页 >

c 读取txt文件 使用 PHP 读取文本(TXT)文件 并分页显示

火烧 2021-12-04 04:19:01 1074
使用 PHP 读取文本 TXT 文件 并分页显示 view ource ri t? lt ? h // you hould ave thi file a m h e io _ tart if em t
c 读取txt文件 使用 PHP 读取文本(TXT)文件 并分页显示

使用 PHP 读取文本(TXT)文件 并分页显示  

view source   print? <?php // you should save this file as m php     session_start();      if(empty($page)) {$page= ;}     if(isset($_GET[ page ])==TRUE) {$page=$_GET[ page ]; } ?>  <>  <head>  <meta equiv="Content Type"content="text/; charset=UTF "/>  <title> qqview Read Result</title>  <style type="text/css">  <!   STYLE {font size: px}  STYLE {font size: px}  >  </style>  </head>  <body>  <table width=" %"  bgcolor="#CCCCCC">  <tr>  <td >  <?php  if($page){  $counter=file_get_contents("example txt"); // read the file into a string $length=strlen($counter);  $page_count=ceil($length/ );   functionmsubstr($str$start$len){      $strlength=$start+$len;      $tmpstr="";     for($i= ;$i<$strlength;$i++) {      if(ord(substr($str$i ))== x a) {          $tmpstr = <br /> ;     }     if(ord(substr($str$i ))> xa ) {          $tmpstr =substr($str$i );          $i++;      }     else{          $tmpstr =substr($str$i ); }      }      return$tmpstr;  }  // 截取中文字符串   $c=msubstr($counter ($page )* );  $c =msubstr($counter$page* );  echosubstr($c strlen($c) strlen($c ) strlen($c));  }?>  </td>  </tr>  </table>   <table width=" %"  bgcolor="#cccccc">  <tr>  <td width=" %"align="center"valign="middle"><span class="STYLE "> <?php echo$page;?> / <?php echo$page_count;?> 页 </span></td>  <td width=" %"height=" "align="left"valign="middle"> <span class="STYLE "> <?php echo"<a href=m php?page= >首页</a> ";   if($page!= ){      echo"<a href=m php?page=" ($page ) ">上一页</a> ";  }  if($page<$page_count){      echo"<a href=m php?page=" ($page+ ) ">下一页</a> ";  } echo"<a href=m php?page="$page_count">尾页</a>";   ?>  </span> </td>  </tr>  </table>  </body>  </> lishixinzhi/Article/program/PHP/201311/21215  
永远跟党走
  • 如果你觉得本站很棒,可以通过扫码支付打赏哦!

    • 微信收款码
    • 支付宝收款码