公告
财富商城
积分规则
提问
发文
2019-08-15 20:34发布
欢心
<li data-docid="thisisthevaluetoget" class="search-results-item"> </li>
How to get the value of "data-docid"?
You may do this using JavaScript + jQuery. You may get the value and pass it into another php file using $_GET method.
an example is here
You can use DOMDocument to get at the attributes:
$html = '<li data-docid="thisisthevaluetoget" class="search-results-item"></li>'; $doc = new DOMDocument; $doc->loadHTML($html); $nodes = $doc->getElementsByTagName('li'); foreach ($nodes as $node) { if ($node->hasAttributes()) { foreach ($node->attributes as $a) { echo $a->nodeName.': '.$a->nodeValue.'<br/>'; } } }
最多设置5个标签!
You may do this using JavaScript + jQuery. You may get the value and pass it into another php file using $_GET method.
an example is here
You can use DOMDocument to get at the attributes: