我想那是VIP的所有HTML類,並打印出每個VIP結果preg_match_all找到兩個詞之間的文本,打印
$text = "<enty> hello baby, we love osama:) That means 2016 set a global heat record<enty2016>for the third year in a row</enty2016>according to NOAA and NASA, who held a joint press conference on Wednesday to discuss the record. <endentry> <enty2016>Temperatures over the Earth's continents and oceans in 2016 were 1.1 degree Celsius (1.98 degrees Fahrenheit) </enty2016>above the pre-industrial average, according to the WMO. That means we are already a <endline>majority of the way to the 1.5-degree warming goal <endenty> ";
我想打印在enty2016s
preg_match("/<enty2016>(.*?)<\/enty2016>/is", $html, $matches);
foreach($matches[1] as $enty2016s){
echo $enty2016s;
}
使用DOM,而不是正則表達式。 –
somtimes我不是在搜索html – newuser0250
你的例子是html,如果你有其他的例子,你應該發佈它們。 – nogad