PHP单词爬虫
如何从一个数组中的网页中获取所有唯一的单词?(没有所有属性和javascript等) 有人能帮我吗?试试这个获取文本 这一个将帮助您:看看 然后做一些类似的事情:PHP单词爬虫,php,curl,Php,Curl,如何从一个数组中的网页中获取所有唯一的单词?(没有所有属性和javascript等) 有人能帮我吗?试试这个获取文本 这一个将帮助您:看看 然后做一些类似的事情: <?php include_once('simplehtmldom/simple_html_dom.php'); $string = file_get_html('http://www.google.com')->plaintext; $words = preg_split('/[\s,.]+/', $string,
<?php
include_once('simplehtmldom/simple_html_dom.php');
$string = file_get_html('http://www.google.com')->plaintext;
$words = preg_split('/[\s,.]+/', $string, null, PREG_SPLIT_NO_EMPTY);
var_dump(array_unique($words));
?>
uhm,dom->dom文档->所有文本内容/nodeValue内容->通过空格分解为数组->然后查看..玩得开心