테스트 사이트 - 개발 중인 베타 버전입니다

Trying to access array offset on value of type bool 에러 관련 채택완료

강농 1년 전 조회 2,492

</p>

<p><?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);</p>

<p>                            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>';

                            }</p>

<p>                            echo run_replace('thumb_image_tag', $img_content, $thumb);

                        }

                         ?></p>

<p>

 

위에 코드 작성 시

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

 

php 버전은 8.2.4 입니다

 

조언 부탁드립니다

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트
1년 전

</p>

<p><?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);

}

?></p>

<p>

 

요렇게 수정해보세요

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인