Home  >  Article  >  php教程  >  教你如何把一篇文章按要求分段_php基础

教你如何把一篇文章按要求分段_php基础

WBOY
WBOYOriginal
2016-05-17 09:07:451062browse

$a="这是一个小段落.看吧";
$a.="这又是小句!";
$a.="最后一句?";
$a.="这是结果了!";
//其实这是一个长的字句。

$b=split("[\.\!\?]",$a,4);
//根本句号,!号,问号等按自己的要求分段

for($index=0;$index{
print "$index.$b[$index]
";
}
//在循环中读出数组。

?>

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