PHP分页脚本
我想做的是,如果第12个字符在一个单词内(第12个字符不是空格),我想移动光标,直到它找到一个空格,返回该子字符串,尽管它的长度超过12个字符。我该怎么做?谢谢诸如此类的东西:PHP分页脚本,php,pagination,substr,Php,Pagination,Substr,我想做的是,如果第12个字符在一个单词内(第12个字符不是空格),我想移动光标,直到它找到一个空格,返回该子字符串,尽管它的长度超过12个字符。我该怎么做?谢谢诸如此类的东西: $string = "This is my page content. This text will be paginated."; $pageNo = "0"; $pieceLength = "12"; $preparedForPrint = substr($string,$pageNo,$pieceLength
$string = "This is my page content. This text will be paginated.";
$pageNo = "0";
$pieceLength = "12";
$preparedForPrint = substr($string,$pageNo,$pieceLength);
也考虑PHP BuiTuin
这样的事情:
$string = "This is my page content. This text will be paginated.";
$pageNo = "0";
$pieceLength = "12";
$preparedForPrint = substr($string,$pageNo,$pieceLength);
也考虑PHP BuiTuin
< P>偏移量应该是$piecenegth
,但返回的位置仍然是从草堆的开始;偏移量将是$piecenegth
,但返回的位置仍然是从干草堆开始的位置。您可以使用strpos()
您可以使用strpos()
$pieceLength = strpos($string," ",12);