我想抓取pdf链接。但是我得到的一些链接是双重的。如何删除其中一个双链接?谢谢:)删除重复链接
<?php
<include 'simple_html_dom.php';
$url = 'http://scholar.google.com/scholar?hl=en&q=data+mining&btnG=&as_sdt=1%2C5&as_sdtp=';
$html = file_get_html($url) or die ('invalid url');
foreach($html->find('a') as $e) {
$link= $e->href;
if (preg_match('/\.pdf$/i', $link)) {
print_r($link);
}
}
?>
哇!非常感谢你 !我不知道有array_unique函数。太好了! :) – bruine 2012-07-17 01:25:31