_common.php을 만들지 않고 아래 코드를 직접 넣어서 사용.
또는 _common.php의 내용에 넣어서 사용.
[code]
<?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);
[/code]
댓글 10개
게시글 목록
| 번호 | 제목 |
|---|---|
| 22041 | |
| 22035 | |
| 22033 | |
| 22028 | |
| 22019 | |
| 22006 | |
| 22005 | |
| 21995 | |
| 21989 | |
| 21978 | |
| 21972 | |
| 21961 | |
| 21956 | |
| 21944 | |
| 21934 | |
| 21932 | |
| 21924 | |
| 21922 | |
| 21921 | |
| 21910 | |
| 21908 | |
| 21897 | |
| 21883 | |
| 21881 | |
| 21875 | |
| 21854 | |
| 21852 | |
| 21851 | |
| 21829 | |
| 21817 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기