$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);
我只是想知道如何去做。
谢谢