PHP 스크립트를 만들어 afp 서버에 연결하고 각 파일 크기의 디렉토리 목록을 가져 오려고합니다. 서버는 우리 사무실에서 로컬이지만, 나는 afp 서버 측에서 스크립트를 만들 수 없습니다. 내 컴퓨터에서 다음과 같이 사용합니다 :PHP를 사용하여 원격 afp 서버에 연결
$filesInDir = array();
$filesInMySQL = array();
if (is_dir($uploadDir)) {
$dh = opendir($uploadDir);
if ($dh) {
$file = readdir($dh);
while ($file != false) {
$path = $uploadDir . "/" . $file;
$type = filetype($path);
if ($type == "file" && $file != ".DS_Store" && $file != "index.php") {
$filesInDir[] = $file;
}
$file = readdir($dh);
}
closedir($dh);
} else {
echo "Can't open dir " . $uploadDir;
}
} else {
echo $uploadDir . " is not a folder";
}
그러나 afp 서버에 연결할 수 없습니다. 나는 AFP를 허용하지 않습니다 fopen을 살펴본 결과는 디렉토리 목록 허용 거라고 생각하지 않습니다
opendir("afp://ServerName/path/to/dir/");
Warning: opendir() [function.opendir]: Unable to find the wrapper "afp" - did you forget to enable it when you configured PHP? in...
Warning: opendir(afp://ServerName/path/to/dir/) [function.opendir]: failed to open dir: No such file or directory in...`
나는 파일이 존재하는지 찾는 게 아니에요,하지만 전체를 얻을 수 디렉토리 목록. 결국 출력 디렉토리에 파일을 원격 복사해야합니다.
예 :
mkdir afp://ServerName/output/output001/
cp afp://ServerName/path/to/dir/neededfile.txt afp://ServerName/output/output001/
흥미로운 질문을하지만, 내가 전에 야생에서 PHP를위한 AFP 래퍼를 본 적이 없어, 그래서 난 내 숨을하지 않을 . ;) – deceze
비록 SMB 래퍼를 보았습니다 ... 문제의 공유에서 smb를 사용할 수 있다면 그 것을 사용할 수 있습니다. – prodigitalson