-2
我想弄清楚如何抓住H1内部的字符串,实际上没有H1内的字符串。PHP查找功能没有找到元素html
$html = "<div id="test"><h1>hello world</h1></div>"
foreach($html->find('div[id=test] h1') as $test1){
echo '<div>';
echo $test1;
echo '</div>';
}
$test1 returns "<h1>hello world</h1>"
我想$ test1只是“hello world”而没有h1标签。谢谢你在前进
这并不似乎是有效的PHP的。 –
'echo“
”.strip_tags(“ ”)。“
”;' – samayohello world
啊,带标签。非常感谢! echo strip_tags($ test1); – user3097760