다른경로에서 인클루드

다른경로에서 인클루드

QA

다른경로에서 인클루드

답변 2

본문

루트경로기준.
subpage/include/s0101.php
를 중심으로
루트에에 있는
_head.php
_tail.php
를 인클루드를 하려고하는데요...빈 화면이 나옵니다ㅠㅠ
어떻게 해결해야 할까요?
먼가 보안적으로 막아논건지;;왜 외부에서 인클루드 하면 빈화면이 나올까요?
제가해본 방법
제가해본 방법1.절대경로이용
<?
include_once($_SERVER[DOCUMENT_ROOT]."/_common.php");
include_once($_SERVER[DOCUMENT_ROOT]."/lib/latest.lib.php");
include_once($_SERVER[DOCUMENT_ROOT]."/_head.php");
?>
<?
include_once($_SERVER[DOCUMENT_ROOT]."../_tail.php");
?>
제가해본 방법2.상대경로 이용
<?
include_once("../../_common.php");
include_once("../../lib/latest.lib.php");
include_once("../../_head.php");
?>

<?
include_once("../../_tail.php");
?>
알려주시면 감사하겠습니다.

이 질문에 댓글 쓰기 :

답변 2

1. include 폴더에 _common.php를 만듭니다
내용
<?
$g4_path="../..";
include_once("$g4_path/_common.php");
?>

2. s0101.php
<?
include_once("_common.php");
include_once("$g4[path]/lib/latest.php");
include_once("$g4[path]/_head.php");
?>

<?
include_once("$g4[path]/_tail.php");
?>

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 123,728
© SIRSOFT
현재 페이지 제일 처음으로