Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP-正确的路径,但映射驱动器上的映像已损坏_Php_File Exists_Mapped Drive_Net Use - Fatal编程技术网

PHP-正确的路径,但映射驱动器上的映像已损坏

PHP-正确的路径,但映射驱动器上的映像已损坏,php,file-exists,mapped-drive,net-use,Php,File Exists,Mapped Drive,Net Use,我有以下PHP代码来访问映射的驱动器Z: $mapped = "\\\\192.168.0.xxx\\Shared"; system('net use Z: "$mapped" @Password /user:Username /persistent:no'); 然后检查映射驱动器上是否存在照片: $pic_path = "Z:/PHOTOS/SUB_FOLDER/Photo.jpg"; echo file_exists($pic_path); //returns 1 (true) 这条路走



我有以下PHP代码来访问映射的驱动器Z:

$mapped = "\\\\192.168.0.xxx\\Shared";
system('net use Z: "$mapped" @Password /user:Username /persistent:no');
然后检查映射驱动器上是否存在照片:

$pic_path = "Z:/PHOTOS/SUB_FOLDER/Photo.jpg";
echo file_exists($pic_path);
//returns 1 (true)
这条路走得很好。但是,它返回一个损坏的图像。为什么?

请帮忙。谢谢

更新:

我已经尝试了以下路径:

\\\\192.168.0.xxx\\e$\\Shared\\PHOTOS\\SUB_FOLDER\\Photo.jpg<br/>
\\\\192.168.0.xxx\\e:\\Shared\\PHOTOS\\SUB_FOLDER\\Photo.jpg<br/>
\\\\192.168.0.xxx\\Shared\\PHOTOS\\SUB_FOLDER\\Photo.jpg<br/>
\\\\192.168.0.xxx\\e$\\Shared\\PHOTOS\\SUB\u FOLDER\\Photo.jpg
\\\\192.168.0.xxx\\e:\\Shared\\PHOTOS\\SUB\u FOLDER\\Photo.jpg
\\\\192.168.0.xxx\\Shared\\PHOTOS\\SUB\u FOLDER\\Photo.jpg

它们都返回1个值。但我仍然收到一个损坏的图像。

UNC路径在PHP中最多只能是零散的,而且,您的PHP进程可能在没有用户配置文件的情况下运行(即在IIS中,除非您显式加载了它,即使这样,它也可能无法工作),因此映射这样的驱动器根本无法工作。假设不需要用户帐户,那么在底部指定的路径上你会更幸运。听起来不错。我在我的本地网络中进行了测试,效果良好。当你说“破碎图像”时,你能告诉我们你用来获取图像的代码吗?你怎么知道它坏了,坏了对你意味着什么?