0

我正在尝试使用 phpquery(几乎与 jquery 相同)从页面中解析数据,

我需要代码来获得这两件事,

BK古达会馆

Main Road, C Type Colony, BK 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>
4

1 回答 1

0

怎么样:

pq('div')->remove();
pq('form')->remove();
$text1 = pq('a')->text();
pq('a').remove();
$text2 = pq('td').text();
于 2010-01-28T12:02:45.600 回答