在php中输出段落中第一个句号之后的所有内容


Output everything after the first full stop in a paragraph in php

我的网站上有一个标题部分,它输出新闻文章的标题和第一句话。下面我想输出这篇文章减去第一段的其余部分。

像这样的东西会很好:

// Full Article
$NewsArticle = "This is the article. I hope you like it.";
// Find the First Full stop
// Save everything after the first full stop to $NewsArticle 
$NewsArticle == "I hope you like it";

任何帮助在这将是伟大的!

感谢亚历克斯

试试这个

substr($NewsArticle, strpos($NewsArticle, ".")+1)

直接使用substr函数。

$str = "This is the article. Enjoy reading it. I hope you like it.";
$str_res = substr($str, strpos($str, ".")+1);
echo $str_res;