답변 2개
채택된 답변
+20 포인트
2년 전
$option_item, $supply_item 모두 html 태그를 담고 있는 string 이라서
다음처럼 시도해볼수 있을것 같습니다.
Copy
로그인 후 평가할 수 있습니다
답변에 대한 댓글 4개
�
2년 전
�
2년 전
$option_item, $supply_item 변수에 할당된
html text 를 알수 있다면 문제해결에 조금 더 도움이 될것 같습니다.
html text 를 알수 있다면 문제해결에 조금 더 도움이 될것 같습니다.
�
2년 전
html text를 잘 모릅니다.ㅜㅜ
아래의 테마를 사용하고 있습니다.
http://g5_shop_001.eyoom.kr/shop/item.php?it_id=1655546071
아래의 테마를 사용하고 있습니다.
http://g5_shop_001.eyoom.kr/shop/item.php?it_id=1655546071
�
2년 전
테마파일 출처를 찾지못해 원본 소스코드 자체를 확인하지는 못했고
뿌려지는 소스코드를 참조해 함수 내용이 수정되었습니다.
[code]
function option_subject_to_first_option($source) {
$src = $source;
$subjects = [];
preg_match_all('!<label.*?</label>!s', $src, $subjects);
if (count($subjects) > 0) {
$subjects = current($subjects);
$subjects = array_map(function ($v) { return '<option value="">' . strip_tags($v) . '</option>'; }, $subjects);
$src = preg_replace_callback('!<option value="">.*?</option>!s', function ($matches) use (&$subjects) {
$replacement = current($subjects);
next($subjects);
return $replacement;
}, $src);
}
return $src;
}
[/code]
뿌려지는 소스코드를 참조해 함수 내용이 수정되었습니다.
[code]
function option_subject_to_first_option($source) {
$src = $source;
$subjects = [];
preg_match_all('!<label.*?</label>!s', $src, $subjects);
if (count($subjects) > 0) {
$subjects = current($subjects);
$subjects = array_map(function ($v) { return '<option value="">' . strip_tags($v) . '</option>'; }, $subjects);
$src = preg_replace_callback('!<option value="">.*?</option>!s', function ($matches) use (&$subjects) {
$replacement = current($subjects);
next($subjects);
return $replacement;
}, $src);
}
return $src;
}
[/code]
댓글을 작성하려면 로그인이 필요합니다.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
올려주신 코드를 삽입했는데. 변화는 없습니다.
답변 주셔서 감사합니다.ㅜㅜ