PHP | DOMDocument - DOMXPath 사용방법
페이지 정보
작성자 굿스웹 작성일19-02-09 21:57 조회1,170회 댓글0건관련링크
본문
$html = '<img id="12" border="1" src="파일명.jpg" alt="제목" width="100" height="100" >';
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML($html); // 로딩 html
$xpath = new DOMXPath($doc);
$nodelist = $xpath->query("//img"); // 위치
$node = $nodelist->item(0); // 배열 위치
$value = $node->attributes->getNamedItem('src')->nodeValue;
echo "위치 태그 출력
//print '<pre>';
//print_r($_rddata);
//print '</pre>';
$doc = new DOMDocument();
libxml_use_internal_errors(true);
$doc->loadHTML($html); // 로딩 html
$xpath = new DOMXPath($doc);
$nodelist = $xpath->query("//img"); // 위치
$node = $nodelist->item(0); // 배열 위치
$value = $node->attributes->getNamedItem('src')->nodeValue;
echo "위치 태그 출력
//print '<pre>';
//print_r($_rddata);
//print '</pre>';
[주소복사] https://www.goodsweb.kr/?u=D419ruXS
SNS 알리기
핀터레스트
텔레그램로
블로그로
페이스북
트위터
카카오스토리
카톡 공유
관련 블로그
로딩중