PHP100 2019-03-27
代码如下:
include 'phpQuery/phpQuery.php'; 
phpQuery::newDocumentFile('//www.jb51.net'); 
echo pq(".blkTop h1:eq(0)")->html();代码如下:
include 'phpQuery/phpQuery.php'; 
phpQuery::newDocumentFile('//www.jb51.net'); 
$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如何在php中方便地解析html代码,估计是每个phper都会遇到的问题。然后在项目中引用。<div class="thumb" id="Thumb-13164-3640" style="positi