我试图使用phpquery解析页面上的数据(几乎和jquery一样),
我需要代码来获取这两件事,
B K Guda协会会馆
和
Main Road,C Type Colony,B K Guda
其他事情可以省略..
这是html
<td>
<a href="#...">
<span class="a12bl">
<u>
<h2 class="bold">B K Guda Association Hall</h2>
</u>
</span>
</a>
Main Road, C Type Colony, B K Guda <br>
<!--filter this out...-->
<div style="float: left;" id="42918save">
<a href="http://www.fullhyderabad.com/profile/locations/42918/1#tabs"><u>Rate</u></a> • <a href="javascript:savesubmit('form42918','results42918','','locations',%20'42918')"><u>Save</u></a> • <a href="http://www.fullhyderabad.com/profile/locations/42918/4"><u>Map</u></a> <div style="clear: both;"></div>
</div>
<!--AJAX MAIN DIV END-->
<form style="margin: 0px;" name="deleteform42918">
<input type="hidden" value="42918" name="eventid">
<input type="hidden" value="delete" name="edittype">
</form>
<form style="margin: 0px;" name="form42918">
<input type="hidden" value="42918" name="eventid">
<input type="hidden" value="update" name="edittype">
</form>
<div style="clear: both;"></div>
<div id="results42918">
</div>
</td>
答案 0 :(得分:0)
怎么样:
pq('div')->remove();
pq('form')->remove();
$text1 = pq('a')->text();
pq('a').remove();
$text2 = pq('td').text();