PHP分页不切割单词
<?php function englishSubstr($str,$start,$end) { if($start!=0) { if(substr($str,$start-1,1)!=" ")//如果被截的字母前面一个不是空格,表格这个字母并不是一个单词的开始 { //那么我们就去除第一个不完整单词 $i; for($i=1;$i<20;$i++) { if(substr($str,$start+$i,1)==" ") //向下循环,直到空格为止,然后高空格后的第一个字母为分页的第一个单词的开始 { break; } } $start+=$i; } } if(substr($str,$end,1)!="")//如果结束处不是空格,表示一个单词还没有完 { $i; for($i=1;$i<20;$i++)//往下循环,直到找到空格后退出, { if(substr($str,$start+$end+$i,1)==" ") { break; } } $end+=$i; } //获取分断单词 return substr($str,$start,$end); } // phper地带 http://www.phperzone.cn/portal.php?mod=view&aid=647
Copy after login
Statement of this Website
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

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Save File Location: Where Is It & How to Protect It?
3 weeks ago
By DDD

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
