有大神用过PHP Simple HTML DOM Parser这个吗 求指教
如何用这个获取
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="titleTop2">
<tr>
<td class="pageAlign">
<table cellpadding="0" width="100%" class="displayTag" cellspacing="1" border="0" id="user">
<thead>
<tr>
<th align="center" width="10%" class="sortable">课程号</th>
获取到 课程号 这三个字
我就喜欢宅
11 years, 7 months ago
Answers
$html = "<table>...</table>";
$htmlObject = str_get_html($html);
$th = $htmlObject->find('th', 0);
$text = $th->plaintext;
Susan
answered 11 years, 7 months ago
php
$html = >>>XML <table> <th align="center" width="10%" class="sortable"> 课程号 </th> </table> XML $xml = simplexml_load_string($html) $ths = $xml->xpath("/table/th/[@category='sortable']") print_r($ths[0]) // 课程号
顺便给你找了一条 xpath 资料
如果你使用过 jquery 的话,可以试试 phpQuery
bondson
answered 11 years, 7 months ago