你好我有一个变量,其中包含以下文字:
<p>Not sure exactly which property you want to extract, but I assume it's the 'question_answers_url'.</p>
<pre><code>$answersArray = Array();
for($i=0;$i<count($jsonArray['questions']);$i++){
//assuming it is the 'question_answers_url' property that you want
array_push($answersArray,$jsonArray['questions'][$i]['question_answers_url']);
}
</code></pre>
<p>Ought to do it.</p>
我怎样才能获得<p>TEXT_I_WANT</p>
之间的文字和其他所有内容。
答案 0 :(得分:2)
preg_match_all("/<p>(.*?)<\/p>/is",$text,$matches,PREG_SET_ORDER);
foreach($maches as $match){
echo $match[1];
}
未经测试!!
已更新!