리스트에서 에디터 이미지 여러개 채택완료
<?php
$n = 0;
for ($i=0; $i < $list_cnt; $i++) {
// 글수 체크
if (!$list[$i]['is_notice'])
$n++;
preg_match_all("/<img[^>]*src=[\"']?([^>\"']+)[\"']?[^>]*>/i", $list[$i]['wr_content'],$matches);
$img = get_view_thumbnail($matches[1][0]);
한개 아닌 여러개 뽑아 올려면 어떻게 하면 될까요?
답변 4개
댓글을 작성하려면 로그인이 필요합니다.
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
$pattern = "/<img.*?src=[\"']?(?P<url>[^(http)].*?)[\"' >]/i";
preg_match($pattern,stripslashes(str_replace('&','&',$list[$i]["wr_content"])), $match);
$img = substr($match['url'],1);
이것도 여러개 안되나요? 하나씩 해야 되요?
답변에 대한 댓글 1개
preg_match($pattern,stripslashes(str_replace('&','&',$list[$i]["wr_content"])), $match);
이후에
print_r( $match);
라고 하셔서 배열이 어떤 형식인지 한번 파악해 보세요.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
https://www.php.net/manual/en/function.preg-match-all.php