언어/PHP

preg_match 함수 정규식을 이용한 <IMG> 태그 추출

greathuman 2019. 7. 4. 17:03

preg_match("/<img[^>]*src=[\"']?([^>\"']+)[\"']?[^>]*>/i", $content, $matches);

 

$matches[0] //img 태그 전체

$matches[1] //img 태그 중 src 값

 

 

 

 

 

 

출처 : https://whiterussian.tistory.com/81