2017-10-25 3 views
0

임 내 주요 index.php로 일부 PHP 파일을 요구하려고 작동하지 그러나 나는 다음과 같은 오류가 발생합니다 :XAMPP는 include_path를

set_include_path('/opt/lampp/htdocs/'); 
require dirname(__FILE__).'/steamauth/steamauth.php'; 

내 포함 파일 :

Warning: require(/opt/lampp/htdocs/steamauth/userinfo.php): failed to open stream: No such file or directory in /opt/lampp/htdocs/index.php on line 4

Fatal error: require(): Failed opening required '/opt/lampp/htdocs/steamauth/userinfo.php' (include_path='/opt/lampp/htdocs/') in /opt/lampp/htdocs/index.php on line 4

내가 추가하는 다음 코드를 시도 steamauth.php와 userinfo.php는/opt/lampp/htdocs/steamauth/ 에 있습니다. php.ini 파일에 include_path를 설정하고이 파일을 내 .htaccess 파일에 추가하려고했습니다. 그리고 네, 이것이 제가 포함시키고 자하는 올바른 길이라고 확신합니다. 어떤 아이디어?

답변

0

프로젝트 폴더 구조 란 무엇입니까? 간단히 index.php에서 경로를 바로 잡으십시오.

// /root/fooDir/userinfo.php 
// /root/barDir/index.php 

//in index.php 
$dir = __DIR__ . '/../fooDir/userinfo.php'; 
+0

아무 것도 작동하지 않는 것 같습니다. 이 문제는 php.ini의 include_path에서 문제라고 생각했지만 문제를 해결하지 못했습니다. 기본 XAMPP include_path 변수를 어떻게 바꿀 수 있습니까? – shimonchick

0

PHP 경로에 새 디렉토리를 추가하려는 경우에도 동일한 문제가있었습니다. 나는 그것을 큰 따옴표에 추가하여 php.ini 파일의 include_path를 둘러 봤습니다. 다음과 같이 표시됩니다.

+0

작은 따옴표가 여기에 있습니다. 아마도 코드를 편집해야 할 수도 있습니다. – Simon

관련 문제