我怎么能删除PHP中的单词?

时间:2015-06-03 11:18:31

标签: 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”解决我的问题,但我不知道如何在我的代码中使用它。

1 个答案:

答案 0 :(得分:0)

就这么简单:

<?php
    // ... the first 4 lines
    $aufrufe2 = explode("</span></span>" , $aufrufe1[1]);
    $temp = str_replace('Restzeit: ','',$aufrufe2[0]);
    echo $temp;
?>