Home  >  Article  >  Backend Development  >  DOM XPATH query_PHP tutorial to obtain img src value

DOM XPATH query_PHP tutorial to obtain img src value

WBOY
WBOYOriginal
2016-07-21 16:13:00875browse

Copy code The code is as follows:

$nodes = @$xpath->query("//*[@id='main_pr ']/img/@src");
$prurl = $nodes->item(0)->nodeValue;

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/313583.htmlTechArticleCopy the code as follows: $nodes = @$xpath-query("//*[@id='main_pr ']/img/@src"); $prurl = $nodes-item(0)-nodeValue;...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn