问题描述
我已将Z:驱动器映射为指向Windows资源管理器中网络上另一台服务器上的文件共享.我可以访问文件并在那里读/写就可以了.
I have mapped my Z: drive to point to a file share on another server on my network in Windows Explorer. I can access the files and read/write just fine there.
当我尝试从PHP执行mkdir()时,出现没有这样的文件或目录"错误.
When I try to execute mkdir() from PHP, I get a "No such file or directory" error.
作为测试,我授予所有人访问读取,写入和执行的权限,但仍然无法正常工作.
As a test, I gave Everyone access to read, write, and execute and it is still not working.
我正在使用的代码:
mkdir('Y:/newfolder/', 0777);
我也尝试过在PHP中再次映射驱动器,但无济于事:
I have also tried mapping the drive again within PHP to no avail:
system('net use Y: "\\DEV01\share" Password1 /user:Administrator /persistent:no>nul 2>&1");
mkdir('Y:/newfolder/', 0777);
请协助.
推荐答案
感谢大家的建议.原来是语法错误.在映射代码中.您必须像上面一样在PHP脚本中手动映射驱动器,除了必须在其中转义反斜杠.代替\\DEV01\share
,必须使用\\\\DEV01\\share
.
Thanks for your advice everyone. It turned out to be a syntax error. In the mapping code. You must map the drive manually within the PHP script like I did above, except you have to escape your backslashes in there. Instead of\\DEV01\share
, you must use \\\\DEV01\\share
.
这篇关于PHP is_dir和mkdir在映射的网络驱动器上不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!