我想抓取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