当我通过ip或计算机名称使用php读取LAN网络上的文件。使用php读取ip或计算机名网络上的文件
$url = "\\\\192.168.0.200\\testshare\\1.txt";
if(file_exists($url) == TRUE) {
echo "OK";
} else {
echo "Error";
}
结果:总是“错误”。 如果我使用函数file_get_contents($ url,true);结果:
Warning: file_get_contents(\\192.168.0.200\testshare\1.txt) [function.file-get-contents]: failed to open stream: Permission denied in D:\services\htdocs\test.php on line 3
当然,文件夹“testshare”设置共享和许可所有人完全控制。如果我的网络浏览器是磁带:\ 192.168.0.200 \ testshare \ 1.txt它读取文件1.txt的内容。 你能帮我吗?每个想法都能帮助我,我非常感谢。
我想你不能检查其他电脑上的文件存在 – 2012-04-26 04:56:35
什么版本的Windows? – 2012-04-26 05:09:08
这里的技术术语是,您正尝试访问* SMB共享*。我没有使用PHP的经验。如果您将其输入浏览器(IE?),则操作系统(Windows)会处理它,这显然是有效的。 – deceze 2012-04-26 05:09:38