這是我的代碼:如何刪除php中的單詞?
<?php
$url = 'http://www.ebay.de/itm/321773181887';
$aufrufe_content = file_get_contents($url);
$aufrufe1 = explode('<span id="vi-time-wrapperSection">' , $aufrufe_content);
$aufrufe2 = explode("</span></span>" , $aufrufe1[1]);
echo $aufrufe2[0];
?>
我怎麼能刪除單詞 「Restzeit:」?
我在其他網站上閱讀我可以用「str_replace」解決我的問題,但我不知道如何在代碼中使用它。
你嘗試並使用它?我的意思是最壞的情況,它會拋出一個錯誤,你必須再次移除它? – Epodax
'str_replace('Restzeit:','',$ string)' –
你可以使用字符串替換,就像第一個參數是你想替換第二個參數是你想替換它的地方,第三個是你想要的變量編輯''''$ newvar = str_replace('Restzeit:','',$ var);''''在這裏閱讀更多內容http://php.net/str_replace – Szenis