Trying to access array offset on value of type bool 에러 관련

🙏SIR UI/UX 디자인 의뢰(~7/31)
Trying to access array offset on value of type bool 에러 관련

QA

Trying to access array offset on value of type bool 에러 관련

본문


<?php
                        if ($list[$i]['is_notice']) { // 공지사항  ?>
                            <span class="is_notice" style="<?php echo $line_height_style; ?>">공지</span>
                        <?php } else {
                            $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true);
                            if($thumb['src']) {
                                $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >';
                            } else {
                                $img_content = '<span class="no_image" style="'.$line_height_style.'">no image</span>';
                            }
                            echo run_replace('thumb_image_tag', $img_content, $thumb);
                        }
                         ?>

 

위에 코드 작성 시
if($thumb['src']) {
해당 부분에서 Trying to access array offset on value of type bool 에러 발생하고 있습니다

 

php 버전은 8.2.4 입니다

 

조언 부탁드립니다

이 질문에 댓글 쓰기 :

답변 1


<?php
if ($list[$i]['is_notice']) { // 공지사항  ?>
    <span class="is_notice" style="<?php echo $line_height_style; ?>">공지</span>
<?php } else {
    $thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true);
    if(is_array($thumb) && isset($thumb['src'])) {
        $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" >';
    } else {
        $img_content = '<span class="no_image" style="'.$line_height_style.'">no image</span>';
    }
    echo run_replace('thumb_image_tag', $img_content, $thumb);
}
?>

 

요렇게 수정해보세요

답변을 작성하시기 전에 로그인 해주세요.
전체 17
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT