2016-09-28 27 views
0

任何其他方式我有如下表結構,如何獲取所有TD值usign正則表達式或PHP

我想從第三列是原廠零件號獲取所有值。

請檢查附件截圖。

<table class="stripeMe"> 
    <tbody> 
    <tr> 
     <th>Image</th> 
     <th>Part#</th> 
     <th>Original#</th> 
     <th>Description</th> 
    </tr> 
    <tr class="alt"> 
     <td> 
     <a href="/item/8438657/High_Capacity/AC-C27/18_TO_20_VOLT_65_WATT_AC_ADAPT"><img width="75" height="75" title="AM11X-2719 18 TO 20 Volt 65 Watt AC Adapter" src="/shop/images/image.php?img=BAT\8438657.jpg&amp;thumbnail=Y"></a> 
     </td> 
     <td><a title="AM11X-2719 18 TO 20 Volt 65 Watt AC Adapter" href="/item/8438657/High_Capacity/AC-C27/18_TO_20_VOLT_65_WATT_AC_ADAPT">AC-C27</a></td> 
     <td>TR82J</td> 
     <td>18 TO 20 Volt 65 Watt AC Adapter</td> 
    </tr> 
    <tr class=""> 
     <td> 
     <a href="/item/10242499/High_Capacity/DRAC90B/DURACELL_90W_19V_UNIVERSAL_NOT"><img width="75" height="75" title="AM11X-2719 Duracell 90W 19V Universal Notebook AC Adapter" src="/shop/images/no_picture_thumb.jpg"></a> 
     </td> 
     <td><a title="AM11X-2719 Duracell 90W 19V Universal Notebook AC Adapter" href="/item/10242499/High_Capacity/DRAC90B/DURACELL_90W_19V_UNIVERSAL_NOT">DRAC90B</a></td> 
     <td>331-0536</td> 
     <td>Duracell 90W 19V Universal Notebook AC Adapter</td> 
    </tr> 
    </tbody> 
</table> 

enter image description here

+1

使用PHP簡單DOM解析器的http:// simplehtmldom。 sourceforge.net/ – Sasikumar

+0

可以請舉例 – John

+0

html表格是一個字符串是從網站上獲取的。簡單的DOM解析器手冊將有助於舉例。 http://simplehtmldom.sourceforge.net/manual.htm有一個明確的方式來做到這一點。 – Sasikumar

回答

相關問題