Home  >  Article  >  Backend Development  >  Extra long text paging display function implemented in PHP

Extra long text paging display function implemented in PHP

不言
不言Original
2018-06-05 10:24:582476browse

This article mainly introduces the paging display function of ultra-long text implemented by PHP, involving PHP's calculation, interception, traversal and other related operation skills for strings. It can realize the paging display function of ultra-long text. Friends who need it can Refer to the following

The example of this article describes the paging display function of ultra-long text implemented in PHP. Share it with everyone for your reference, the details are as follows:

1. Code

1, index.php





超长文本的分页显示



  
页次: / 分页: 首页 "; echo "上一页 "; } if($_GET<$page_count){ echo "下一页 "; echo "尾页"; } ?>

2 , function.php

0xa0){   //如果字符串中首个字节的ASCII序数值大于0xa0,则表示为汉字
        $tmpstr.=substr($str,$i,2);   //每次取出两位字符赋给变量$tmpstr,即等于一个汉字
        $i++;              //变量自加1
      }else{               //如果不是汉字,则每次取出一位字符赋给变量$tmpstr
        $tmpstr.=substr($str,$i,1);
      }
    }
    return $tmpstr;             //输出字符串
  }
?>

2. Running results

##Related recommendations:

phprealnowreport (jpgraph plug-inrealnow)

The above is the detailed content of Extra long text paging display function implemented in PHP. For more information, please follow other related articles on the PHP Chinese website!

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