gpt4 book ai didi

PHP HTML DOM 解析

转载 作者:行者123 更新时间:2023-12-04 07:01:21 26 4
gpt4 key购买 nike

<table width="100%" cellspacing="0" cellpadding="0" border="0" id="Table4">
<tbody>
<tr>
<td valign="top" class="tx-strong-dgrey">
<a class="anc-noul" href="http://www.example.com/catalog/proddetail.asp?logon=&amp;langid=EN&amp;sku_id=0665000FS10129471&amp;catid=25653">
Apple 8GB 3rd Generation iPod Touch</a></td>
</tr>
<tr>
<td valign="top" class="element-spacer"/>
</tr>
<tr>
<td valign="top" class="tx-normal-grey">
Product detail
<a href="http://www.example.com/catalog/proddetail.asp?logon=&amp;langid=EN&amp;sku_id=0665000FS10129471&amp;catid=25653">
More Info</a></td>
</tr>
<tr>
<td valign="top" class="element-spacer"/>
</tr>
<tr>
<td valign="top" class="tx-normal-red">
<span class="tx-strong-dgrey">Price:</span>
$189.99</td>
</tr>
<tr>
<td valign="top">You save: $9.00 after instant savings</td>
</tr>
<tr>
<td valign="top" class="element-spacer"/>
</tr>
<tr>
<td valign="top" class="tx-normal-grey">
<a href="http://www.example.com/catalog/subclass.asp?catid=25653&amp;logon=&amp;langid=EN">
View similar products</a>
<a href="http://www.example.com/catalog/mfr.asp?man=Apple&amp;catid=19&amp;logon=&amp;langid=EN">
View similar products with same brand</a>
</td></tr>
<tr>
<td valign="top" class="element-spacer"/>
</tr>
</tbody>
</table>

我希望能够获得 189.99 美元。
echo $ret[0]->find('tr', 4)->plaintext;

这输出:'价格:189.99美元'

我只需要 189.99 美元,而不是“价格:”

最佳答案

$exp = explode(":", $ret[0]->find('tr', 4)->plaintext);
$price =$exp[1];

关于PHP HTML DOM 解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1784765/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com