PHP从网络驱动器读取或复制文件(窗口) [英] PHP Read or Copy File from a Network Drive (Window)
问题描述
我安装了一个窗口驱动器
I have a window drive mounted as
\\192.168.0.168\
它被安装为Z驱动器
此文件夹中的文件DOC,MYFOLDER,FILE1.PDF是我想要readfile()或通过php复制的(我也将使用它复制其他文件)
There this file in folder DOC,MYFOLDER,FILE1.PDF that I wanna readfile() or copy out through php (I will use it to copy other file also)
但是我也尝试过
$file_path = "\\192.168.0.168\DOC\MYFOLDER\FILE1.pdf";
$filesize = ($file_path);
echo "FILE SIZE IS $filesize";
它不返回任何值,只是FILE SIZE IS
it return no value, just FILE SIZE IS
当我想将此网络驱动器文件共享到IIS Web服务器时,如何访问Z驱动器或192.168.0.168 \ DOC \ MYFOLDER \ FILE1.pdf,以便用户可以通过我的Web服务器下载PDF.
How do I access my Z drive or the 192.168.0.168\DOC\MYFOLDER\FILE1.pdf as I wanna share this Network drive file to my IIS Web Server so user can download the PDF through my web server.
谢谢!
推荐答案
反斜杠\
是转义字符,需要对其进行转义:
The backslash \
is the escape character, it needs to be escaped:
$file_path = "\\\\192.168.0.168\\DOC\\MYFOLDER\\FILE1.pdf";
请注意,PHP不支持Windows网络身份验证.您也许可以通过自己的方式入侵,但我宁愿将网络位置安装为网络驱动器.
Please note that PHP does not support Windows network authentication. You may be able to hack your way through, but I would rather mount the network location as a network drive.
这篇关于PHP从网络驱动器读取或复制文件(窗口)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!