Illegal string offset 뜹니다.

Illegal string offset 뜹니다.

QA

Illegal string offset 뜹니다.

본문

php5.6에서 잘 되던 것이

php7.4에서 저렇게 뜹니다.

 


Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 27

Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 37

Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 48

Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 27

Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 37

Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 48

Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 27

Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 37

Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 48

Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 27

Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 37

Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 48

Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 27

Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 37

Warning: Illegal string offset 'bo_table' in /home1/test/public_html/sitemap/sitemap.php on line 48

 

소스는 아래와 같습니다.


<?php
    # 총 4군데 변경입니다.
    # common.php 파일 위치 절대 경로 세팅
    include_once ("../common.php"); # 꼭 변경하세요.
    # 기본 설정
    $wwwPath = "../"; # 꼭 변경하세요.
    $wwwURL = "http://domail.com"; # 꼭 변경하세요.
    
    # 게시판 리스트
    $sql = " SELECT * FROM {$g5['board_table']} WHERE bo_read_level = 1";
    $query = sql_query($sql);
    
    while ($row = sql_fetch_array($query)) {
        $board[] = $row;
    }
    
    # 파일 작성 시작
    $sitemap = fopen($wwwPath.'/sitemap/sitemap.xml', 'w') or die('file not found'); # 사이트맵 생성 경로 변경
        fwrite($sitemap, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
        fwrite($sitemap, '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
    
        $boardLink = "";
        $contentLink = "";
        foreach ($board as $key => $val) :
            # 마지막 게시물 시간
            $sql = " SELECT * FROM {$g5['write_prefix']}{$val['bo_table']} WHERE wr_id = wr_parent AND wr_is_comment = 0 ORDER BY wr_datetime DESC LIMIT 0, 1";
            $query = sql_fetch($sql);
            
            # 마지막 게시물 생성 시간이 없으면 현재 시간으로 설정
            $query['wr_datetime'] = (empty($query['wr_datetime'])) ? date('Y-m-d\TH:i:s')."+00:00" : preg_replace("/\s/im", "T", $query['wr_datetime'])."+00:00";
            
            # 게시판 링크 작성
            $boardLink = "";
            $boardLink = "<url>";
                $boardLink .= "<loc>";
                    $boardLink .= G5_URL."/{$val['bo_table']}";
                $boardLink .= "</loc>";
                $boardLink .= "<lastmod>{$query['wr_datetime']}</lastmod>";
                $boardLink .= "<changefreq>daily</changefreq>";
                $boardLink .= "<priority>0.9</priority>";
            $boardLink .= "</url>";
            
            # 게시판 링크 작성
            fwrite($sitemap, $boardLink);
            
            # 게시판 게시물 작성
            $sql = " SELECT * FROM {$g5['write_prefix']}{$val['bo_table']} WHERE wr_id = wr_parent AND wr_is_comment = 0 ORDER BY wr_datetime DESC";
            $query = sql_query($sql);
            
            unset($row);
            while ($row = sql_fetch_array($query)) {
                $row['wr_datetime'] = (empty($row['wr_datetime'])) ? date('Y-m-d\TH:i:sp')."+00:00" : preg_replace("/\s/im", "T", $row['wr_datetime'])."+00:00";
                $contentLink = "";
                $contentLink = "<url>";
                    $contentLink .= "<loc>";
                        $contentLink .= G5_URL."/{$val['bo_table']}/{$row['wr_id']}";
                    $contentLink .= "</loc>";
                    $contentLink .= "<lastmod>".preg_replace("/\s/im", "T", $row['wr_datetime'])."</lastmod>";
                    $contentLink .= "<changefreq>weekly</changefreq>";
                    $contentLink .= "<priority>0.5</priority>";
                $contentLink .= "</url>";
                
                # 게시판 게시물 링크 작성
                fwrite($sitemap, $contentLink);
            }
        endforeach;
        
        fwrite($sitemap, '</urlset>');
    fclose($sitemap);
?>
<p>완료</p>

이 질문에 댓글 쓰기 :

답변 2

5.6꺼를 그대로 쓰고싶으면 7.3으로 바꾸세요 

그담 버전부터들은 배열안에 값들 넣어줄때 ''으로 막아줘야지 오류배출안해요

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

회원로그인

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