【问题标题】:preg_match parsing html tags and insert into variablepreg_match 解析html标签并插入变量
【发布时间】:2011-08-02 19:58:20
【问题描述】:

我有以下标签,我想提取买卖价格:2.9450 和 3.0150

<tr bgcolor="#E8EFF3"> 
<td width="25%" align="center" valign="middle" class="tx11"> 
USD</td> 
<td width="8%" class="tx11">RON </td> 
<td align="right" class="tx11"> 
**2.9450**</td> 
<td width="8%" align="left" class="tx11"></td> 
<td align="right" class="tx11"> 
**3.0150**</td> 
<td width="8%" align="left" class="tx11"></td> 
<td align="right" class="tx11"> 
**2.9249**</td> 
</tr> 
  1. 谁能帮我确定值的模式?
  2. 如何将值提取到变量中? 谢谢你

【问题讨论】:

标签: php mysql curl preg-match


【解决方案1】:
preg_match_all( '/\*\*(.+?)\*\*/s', $str, $matches );

$matches[1][0] 和 $matches[1][1] 将包含您想要的两个数字。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-28
    • 2017-12-22
    • 2016-08-14
    • 1970-01-01
    • 2019-10-01
    相关资源
    最近更新 更多