PHP

[정규 표현식]이미지만 갖고 오기

옥수수빵 2022. 5. 2. 11:54
728x90
$contents = "<p><img src='http://어쩌고저쩌고/upload/data/test.jpg'></p>";
$pattern = "/<img[^>]*src=[\'\"]?([^>\'\"]+[^>\'\"]+)[\'\"]?[^>]*>/i";
preg_match_all($pattern, $contents, $matchs);
print_r($matchs);

 

반응형