在php中的段落中第一次完整停止后输出所有内容

时间:2014-05-20 09:27:30

标签: php html strpos

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

这样的事情会很棒:

// 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";

对此的任何帮助都会很棒!

由于

亚历

2 个答案:

答案 0 :(得分:0)

只需使用substr函数。

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

答案 1 :(得分:0)

试试这个

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