1

很不言自明。例如,文件 (AB.txt) 在我的 C 驱动器和我 (NFS) 安装的 W 驱动器上。Windows 7 x64 操作系统顺便说一句。

function fileExists($path){
     return (@fopen($path,"r")==true);
 }

var_dump(fileExists('C:\AB.txt'));
var_dump(fileExists('W:\AB.txt'));
var_dump(file_exists('C:\AB.txt'));
var_dump(file_exists('W:\AB.txt'));

布尔真
dir='ltr'>布尔假


布尔真
dir='ltr'>布尔假

我无法在 php wiki 或使用 Google 搜索时找到此行为的解释。

4

1 回答 1

0

If you are trying to access a Windows Network Share you have to configure your WebServer with enough permissions for example:

$file = fopen("\\siscomx17\c\websapp.log",'r');

You will get an error telling you that the pathname doesnt exist this will be because Apache or IIS run as LocalSystem so you will have to enter to Services and configure Apache on "Open a session as" Create a new user that has enough permissions and also be sure that target share has the proper permissions.

于 2012-10-07T19:16:57.713 回答