$ details ['wasprice']的值包含單詞「was」(即$ 23.99)。我想刪除「was」一詞,並將該值保留爲「$ 23.99」。下面整理數組的某個值
代碼:
foreach($html->find('div.product-details-contents') as $content) {
$detail['img'] = $content->find('img.product-details-image',0)->src;
$detail['title'] = $content->find('span.title', 0)->plaintext;
$detail['units'] = $content->find('span.unit-size', 0)->plaintext;
$detail['wasprice'] = $content->find('span.was-price', 0)->plaintext;
$detail['nowprice'] = $content->find('span.special-price', 0)->plaintext;
$product[] = $detail;
}
print_r($product);
我只是想知道如何去這一點。
謝謝
'$細節[ 'wasprice'] = str_replace函數( '是', '',$細節[ 'wasprice']);' – 2013-04-10 22:59:56