0

我想将网页中的每个单词(不是标签)放在带有 DOMDocument 的数组中。

$content = '<html><body><h1>Some words</h1>';
$content .= '<p>here is some words <span>there is other words here</span></p>';
$content .= '</body></html>';

$dom = new DOMDocument();
@$dom->loadHTML($content);

$words = array();
// How to do that ?

谢谢

4

0 回答 0