PHP Document Parser:只获得单词

时间:2013-08-31 16:26:10

标签: php html dom

我想将网页中的每个单词(不是标签)放在带有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 ?

由于

0 个答案:

没有答案