2
나는 FileA.php기능을 찾을 수 없습니다
function readDirectory($aPath) {
$list = Array();
if(is_dir($aPath)) {
if ($dh = opendir($aPath)) {
while (($file = readdir($dh)) !== false) {
if(is_file("$aPath/$file") && $file != '.htaccess') {
$list[$file] = "$file";
}
}
closedir($dh);
}
}
sort($list, SORT_STRING);
return $list;
}
에 정의 된이 기능을 가지고 그리고 나는 FileC.php I에 FileB.php included()
다음 FileB.php에 FileA.php included()
했고, 을 실행하고 싶습니다. 하지만 얻을 :
Fatal error: Call to undefined function readDirectory() in ..folder/FileC.php on line 2
무엇이 잘못되었는지 알아낼 수 없습니다.
분명히 포함되어 있지 않습니다. 포함 경로에서 파일 경로가 올바른지 확인하십시오. – naththedeveloper
'포함'대신 '요구'를 사용하십시오. 'require'는 파일이 발견되지 않으면 오류를 반환합니다 (문제가 있는지 확인할 수 있도록). 아마도 파일이 다른 디렉토리에 있으므로 포함 경로를 제어해야합니다. –
파일을 포함하는 방법을 표시하고 [전체 * 오류보고 사용] (http://stackoverflow.com/questions/6575482/how- do-i-enable-error-reporting-in-php)를 사용하십시오. – PeeHaa