復制代碼 代碼如下:
include 'phpQuery/phpQuery.php';
phpQuery::newDocumentFile('http://www.49028c.com');
echo pq(".blkTop h1:eq(0)")->html();
復制代碼 代碼如下:
include 'phpQuery/phpQuery.php';
phpQuery::newDocumentFile('http://www.49028c.com');
$artlist = pq(".blog_li");
foreach($artlist as $li){
echo pq($li)->find('h2')->html()."";
}
復制代碼 代碼如下:
<?xml version="1.0" encoding="utf-8"?>
<root>
<contact>
<name>張三</name>
<age>22</age>
</contact>
<contact>
<name>王五</name>
<age>18</age>
</contact>
</root>
復制代碼 代碼如下:
include 'phpQuery/phpQuery.php';
phpQuery::newDocumentFile('test.xml');
echo pq('contact > age:eq(0)');
結果輸出:22
新聞熱點
疑難解答