리스트에서 에디터 이미지 여러개 채택완료
// 글수 체크 if (!$list[$i]['is_notice']) $n++;
preg_match_all("/]*src=[\"']?([^>\"']+)[\"']?[^>]*>/i", $list[$i]['wr_content'],$matches);
$img = get_view_thumbnail($matches[1][0]);
한개 아닌 여러개 뽑아 올려면 어떻게 하면 될까요?
답변 4개
print_r( $match); 에서 한개밖에 안나옵니다. 이미지가 3개인데 이미지 하나만 나오네요.
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
$pattern = "/
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);
라고 하셔서 배열이 어떤 형식인지 한번 파악해 보세요.
댓글을 작성하려면 로그인이 필요합니다.
$img = get_view_thumbnail($matches[1][0]);
$img1 = get_view_thumbnail($matches[1][1]);
이런 식으로 해 보세요.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
https://www.php.net/manual/en/function.preg-match-all.php