如何用这个获取
<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>
获取到 课程号 这三个字
如何用这个获取
<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>
获取到 课程号 这三个字
php<br>$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 资料
立即学习“PHP免费学习笔记(深入)”;
如果你使用过 jquery 的话,可以试试 phpQuery
$html = "<table>...</table>"; $htmlObject = str_get_html($html); $th = $htmlObject->find('th', 0); $text = $th->plaintext;
官方文档,实例详尽:http://simplehtmldom.sourceforge.net/manual.htm
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号