테스트 사이트 - 개발 중인 베타 버전입니다

./_common.php 로딩 시 Warning이 뜨는데요... 채택완료

더블피디 7년 전 조회 3,674

dd.php 에서  common.php를 인클루드 할 때 아래와 같이 warning이 발생

====>    include_once("../_common.php") ;   정상

....

 

Warning: include_once(./_common.php): failed to open stream: No such file or directory in /home/public_html/req/dd.php on line 2 Warning: include_once(): Failed opening './_common.php' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /home/public_html/req/dd.php on line 2

 

dd.php 내에서   include_once("../_common.php") ;    변경하면 warning 안 뜨고 정상적으로 처리됨

하지만, dd.php에서 다른 함수를 사용(예를 들어 bbs/alert.php)하면 

 

사용하는 alert 함수 내부에서  ./common.php 을 인클루드 함으로  또 Warning이 뜸

 

/bbs/alert.php 

include_once('./_common.php');

 

인클루드 할때 어떻게 해야할지???

댓글을 작성하려면 로그인이 필요합니다.

답변 2개

채택된 답변
+20 포인트
e
7년 전

./_common.php 파일의 소스가 잘못된 듯하네요..

../_common.php 와 비교했을때..

common.php 를 불러오는 경로를 바꿔줘야 합니다.

해보시고 잘 모르시면 두 파일의 소스를 올려보세요..

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

진서기
7년 전

common.php 파일 위치를 기준으로 삼으세요.

 

_common.php 는 무조건

include_once('./_common.php');

 

include 하시고

이 파일이 내용이 common.php 파일을 include 해야 합니다.

 

bbs/파일들 이면

상위 폴더에 common.php 이 있으니

경로는 ../common.php 파일입니다.

 

동일 폴더에

_common.php 파일이 있는지 보세요.

bbs 아래에는

로 되있습니다.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인