2

ディレクトリのファイルのリストを取得するために scandir() を使用しようとしています。

<?php
function getFileList($directory) {
    //Get the listing of the files/folders within the directory, place into an array.
    $files = scandir($directory);
    //Remove . and .. from the array.
    unset($files[0]);
    unset($files[1]);
    //Reindex array.
    $files = array_values($files);

    return $files;
}

$directory = '//192.168.1.20/is/Vendors/DavLong/Krames/';
    $files = getFileList($directory);

?>

このコードを使用すると、ローカル マシン (192.168.1.165) から実行するとうまく機能しますが、会社のイントラネット (192.168.1.35) から実行すると、次の警告が表示され、スクリプトが実行されなくなります。

Warning: scandir(//192.168.1.20/is/Vendors/DavLong/Krames/) [function.scandir]: failed to open dir: Invalid argument in C:\Inetpub\wwwroot\DocumentPrint\index.php on line 4

Warning: scandir() [function.scandir]: (errno 22): Invalid argument in C:\Inetpub\wwwroot\DocumentPrint\index.php on line 4

Warning: array_values() [function.array-values]: The argument should be an array in C:\Inetpub\wwwroot\DocumentPrint\index.php on line 9

Windows でダイアログを実行//192.168.1.20/is/Vendors/DavLong/Krames/し、192.168.1.35 ボックスを使用して入力すると、適切な場所で Windows エクスプローラーが開き、マシンが要求されたアドレスを見つけることができます。

これをローカルおよびイントラネット経由で機能させるために欠けているものを誰かが手伝ってくれますか。状況について何か光を当てることができるかもしれないことを事前に感謝します.

4

1 に答える 1

0

このようなネットワーク経由でのフォルダの読み取りについてはわかりませんが、代わりにネットワーク ドライブをマップし、そのドライブで scandir() を試すことはできないでしょうか?

于 2012-09-10T20:43:00.587 に答える