[이윰] 출석부 문구를 가져오지 못하는 증상 해결하기

페이지 정보

shadow2fox shadow2fox 18 1 1 3시간 53분전

본문

📝출석부 문구를 가져오지 못하는 증상 해결하기

출석부 한마디(문구)를 담고 있는 파일을 @include_once함으로 인해  어떠한 case에서는 파일이 실행되지 않고 한마디(문구)가 세팅되지 않은 상태가 될 수 있는데 @때문에 경고도 묻혀서 에러로 잡히지 않는 증상이다.

1. 기존 case문의 @include_once를 include로 바꿔서 실행한다.

수정 전


        case "words":
            $words_file = EYOOM_USER_PATH.'/page/attendance.words.php';
            if(file_exists($words_file)) {
                @include_once($words_file);
                $count = count($words);
                $key_num1 = $eb->random_num($count-1);
                $key_num2 = $eb->random_num($count-1);
                $output['words']        = $words[$key_num1];
                $output['today_words']    = $words[$key_num2];
                @include_once EYOOM_CLASS_PATH."/json.class.php";
                $json = new Services_JSON();
                $data = $json->encode($output);
                echo $data;
            }
            break;

수정 후


        case "words":
            $words_file = EYOOM_USER_PATH.'/page/attendance.words.php';
            $words = array();
            if (is_file($words_file) && is_readable($words_file)) {
                $tmp = include $words_file;
                if (is_array($tmp)) $words = $tmp;
            }
            $count = count($words);
            if ($count > 0) {
                $key_num1 = ($count > 1) ? $eb->random_num($count-1) : 0;
                $key_num2 = ($count > 1) ? $eb->random_num($count-1) : 0;
                $output = array();
                $output['words']       = isset($words[$key_num1]) ? $words[$key_num1] : '';
                $output['today_words'] = isset($words[$key_num2]) ? $words[$key_num2] : '';
                header('Content-Type: application/json; charset=utf-8');
                // 1) PHP 내장 json_encode 우선 사용
                if (function_exists('json_encode')) {
                    echo json_encode($output, JSON_UNESCAPED_UNICODE);
                } else {
                    // 2) 하위 호환용 Services_JSON fallback
                    @include_once EYOOM_CLASS_PATH."/json.class.php";
                    if (class_exists('Services_JSON')) {
                        $json = new Services_JSON();
                        echo $json->encode($output);
                    }
                }
            }
            break;

2. attendance.words.php도 변수 세팅 방식에서 값 반환 방식으로 수정한다.

수정 전


<?php
if (!defined('_GNUBOARD_')) exit;
$words = array(
    "0"     => "한마디1",
    "1"     => "한마디2",
    "2"     => "한마디3",

수정 후


<?php
if (!defined('_GNUBOARD_')) exit;
return array(
    "한마디1",
    "한마디2",
    "한마디3",

추천인 1
  • 012i1052u
    내사랑
shadow2fox
10
shadow2fox - 회원등급 : 자연/Level 155 - 포인트 : 2,650,893
레벨 155
경험치 3,585,759

Progress Bar 11.31%

- 가입일 : 2015-03-10 12:21:44
- 서명 : 인간에게 가장 큰 선물은 자기 자신에게 기회를 주는 것이다. - 크리스 가드너, Chris Gardner -
- 자기소개 : There's never a shortcut to happiness.

댓글1

내사랑님의 댓글

012i1052u
내사랑 28분전

아하 이윰의 의도?인가 했는데 그게 아니였나 봐요 ㅋㅋ

고급 정보 감사합니다

적용 완료

축하합니다. 첫 댓글로 8경험치를 획득하였습니다.

축하합니다. 지뢰폭탄 제거로 1경험치를 획득하였습니다.

Total 771126 페이지

제목 글쓴이 날짜 조회 추천
이윰  댓글+1⭐ 🚩 출석부 문구를 가져오지 못하는 증상 해결하기 shadow2fox 3시간 53분전 19 1
그누•영카트  댓글+1 그누보드(영카트) 5.6.24 shadow2fox 2026.02.16 65 1
그누•영카트  댓글+2 그누보드(영카트) 5.6.23 shadow2fox 2025.09.23 658 2
그누•영카트  댓글+2 그누보드(영카트) 5.6.22 shadow2fox 2025.09.22 523 2
그누•영카트  댓글+5 그누보드(영카트) 5.6.21 shadow2fox 2025.09.09 615 2
그누•영카트  댓글+2 [5.6.16버전 오류수정]그누보드(영카트) 5.6.17 shadow2fox 2025.09.03 553 3
그누•영카트  댓글+2 그누보드(영카트) 5.6.16 shadow2fox 2025.09.03 481 3
PHP  댓글+2 숫자를 단위로 변환해 표시하기 shadow2fox 2025.08.13 472 3
그누•영카트  댓글+2 그누보드(영카트) 5.6.15 shadow2fox 2025.08.01 407 3
그누•영카트  댓글+1 그누보드(영카트) 5.6.14 shadow2fox 2025.06.14 579 2
PHP  댓글+1📸 node.js를 윈도우 서버에 설치하고 peppeteer 라이브러리를 이용하여 og:image를 추출해 보자 shadow2fox 2025.06.13 528 2
PHP  댓글+1 PHP에서 변수의 값이 날짜 형식이고 유효한 날짜 형식인지 검증해 보자 shadow2fox 2025.06.06 510 1
그누•영카트  댓글+2 그누보드(영카트) 5.6.13 shadow2fox 2025.05.15 706 2
에디터  댓글+1 CKEditor 4.x 툴바에서 소스 글자 지우기 shadow2fox 2025.05.04 719 2
그누•영카트  댓글+2 그누보드(영카트) 5.6.12 shadow2fox 2025.04.16 545 2
그누•영카트  댓글+2 그누보드(영카트) 5.6.11 shadow2fox 2025.04.16 672 2
그누•영카트  댓글+2 그누보드(영카트) 5.6.10 shadow2fox 2025.02.25 636 2
그누•영카트  댓글+2 그누보드(영카트) 5.6.9 shadow2fox 2025.01.22 769 2
그누•영카트  댓글+2 그누보드(영카트) 5.6.8 shadow2fox 2024.11.27 696 3
그누•영카트  댓글+2 그누보드(영카트) 5.6.7 shadow2fox 2024.11.01 982 2
그누•영카트  댓글+1 그누보드(영카트) 5.6.6 shadow2fox 2024.09.24 627 1
그누•영카트  댓글+1 그누보드(영카트) 5.6.5 shadow2fox 2024.09.05 730 1
그누•영카트  댓글+2 그누보드(영카트) 5.6.4 shadow2fox 2024.07.04 900 2
그누•영카트  댓글+2 그누보드(영카트) 5.5.17 shadow2fox 2024.06.09 914 2
이윰  댓글+1 게시글 삭제 시 입력한 태그 삭제하기 shadow2fox 2024.05.11 806 2
그누•영카트  댓글+2 그누보드(영카트) 5.5.16 shadow2fox 2024.04.18 840 2
그누•영카트  댓글+2📸 그누보드(영카트) 5.5.15 shadow2fox 2024.04.12 903 2
그누•영카트  댓글+3🏆 그누보드(영카트) 5.5.14 shadow2fox 2024.04.04 1.3k 2
그누•영카트  댓글+2🏆 그누보드(영카트) 5.5.13 shadow2fox 2024.02.20 1.2k 2
그누•영카트  댓글+2 그누보드(영카트) 5.5.12 shadow2fox 2024.01.26 943 2