어떤사이트에서 이미지를 가져올려고하는데
<img itemprop="image" content="이미지링크"/>
위처럼 되어있어서
~<img\sitemprop=\"image\"\scontent=\"[^"]+\"/>~isx
작성하고하니
이미지가 src 로 안되어있고 content=" 이렇게 되어있네요
정규식으로 content부분을 src로 변경해서 가져오게 해야할거같은데
어떻게 정규식작성해야할까요?
답변 2개
좋은 정보 감사 합니다. ㅠㅠ
2017-01-04 (수) 14:42:01
Copy
<?php $str ='<img itemprop="image" content="이미지링크"/>'; preg_match("#<img\s*itemprop=\"image\"\s*content=\"(.*)\"/>#", $str, $matches); print_r($matches[1]);?>
답변을 작성하려면 로그인이 필요합니다.