0
我正在使用file_get_contents
來讀取.html
有一個表的文件。這個preg_match_all有什麼問題
<table id="someTable" style="width:100%;margin-bottom:0;">
<tr style="display:none;">
<td style="padding-left:25px;">Some text</td>
</tr>
<tr style="display:none;">
<td style="padding-left:25px;">another text</td>
</tr>
</table>
當我使用preg_match_all讀取表,我什麼也沒得到,當我數$matches[1]
preg_match_all('/<table id="someTable" style="width:100%;margin-bottom:0;">(.*)<\/table>/', $html, $matches);
$co = count($matches[1]);
尋找用正則表達式解析HTML是幾乎可以肯定不是要走的路。你想要達到什麼目標? – lonesomeday