2016-01-13 109 views
0

我在做什麼錯?我目前在下面有下面的代碼,我正在嘗試獲取鏈接到直接MP3路徑的輔助網址。爆炸URL

$date = $html2->find('strong > a',0); 
$explode = explode ("http://www.example.com/?dl_name=", $date->href); 
print $explode; 

它返回ARRAY

+0

[爆炸功能](http://php.net/manual/en/function.explode.php)。第一個參數是分隔符。 –

+1

我不確定我有什麼你想要的。 –

回答

1

了,你能str_replace解決此問題:

$secondary_url = str_replace("http://www.example.com/?dl_name=", '', $date->href); 

您將在$secondary_url中獲得該字符串的其餘部分。

參考:str_replace

3

爆炸返回一個字符串數組,請嘗試使用的print_r($爆炸),然後使用$爆炸[0],$爆炸[1] ...