include_once("./_common.php"); 대체하기 > 그누보드5 팁자료실

그누보드5 팁자료실

include_once("./_common.php"); 대체하기 정보

include_once("./_common.php"); 대체하기

본문

_common.php을 만들지 않고 아래 코드를 직접 넣어서 사용.

또는 _common.php의 내용에 넣어서 사용.


<?php
function find_common_php() {
    $current_dir = dirname(__FILE__);
    $parent_dir = "../";
    $count = 0;
    while (!file_exists($current_dir . "/common.php")) {
        $current_dir = dirname($current_dir);
        $count++;
        if ($current_dir === '/' || $current_dir === '.') {
            break;
        }
    }
    return $count;
}
$up_count = find_common_php();
$include_path = str_repeat('../', $up_count) . 'common.php';
include_once($include_path);
추천
8

댓글 10개

전체 2,432 |RSS
그누보드5 팁자료실 내용 검색

회원로그인

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