1

我尝试从外部站点的 html 源代码中获取在和v4.0 with A2DP之后创建的行。在其他情况下可能有其他值,但它总是介于和Yes,,v4.0 with A2DPYes,,

这是html的外部来源:

<tr>
<td class="ttl"><a href="glossary.php3?term=wi-fi">WLAN</a></td>
<td class="nfo">Wi-Fi 802.11 a/b/g/n, dual-band, DLNA, Wi-Fi Direct, Wi-Fi hotspot</td>
</tr>
<tr> 
<td class="ttl"><a href="glossary.php3?term=bluetooth">Bluetooth</a></td>
<td class="nfo">Yes, v4.0 with A2DP, LE, EDR</td>
</tr>
<tr>
<td class="ttl"><a href="glossary.php3?term=nfc">NFC</a></td>
<td class="nfo">Yes</td>
</tr>

我正在使用这段代码:

<?php
include_once('/simple_html_dom.php');
$dom = file_get_html("http://www.gsmarena.com/pantech_vega_no_6-5268.php");
foreach ($dom->find('tr') as $node) {
if (is_a($node->children(0), 'simple_html_dom_node')) {
    if ($node->children(0)->plaintext == "Bluetooth") {
        echo $node->children(1)->plaintext;
    }
}
}
?>

我得到了所有的蓝牙线路:

Yes, v4.0 with A2DP, LE, EDR
4

1 回答 1

0

尝试像这样更改您的代码:

$plain = explode(',', $node->children(1)->plaintext);
echo $plain[1];
于 2013-02-02T09:23:13.007 回答