Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.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中连接到windows远程共享_Php_Windows_Apache_Network Programming_Easyphp - Fatal编程技术网

在PHP中连接到windows远程共享

在PHP中连接到windows远程共享,php,windows,apache,network-programming,easyphp,Php,Windows,Apache,Network Programming,Easyphp,我正在尝试使用php连接到网络中共享的目录(类似于\remoteserver\mydir)。 我尝试了fopen函数,但它告诉我我没有连接的权限,因此该函数似乎到达了服务器,但无法访问目录,这是可以理解的,因为该函数在输入中没有获取凭据。 我还尝试将远程目录作为网络单元(Z:),但该功能仍然无法实现。目前我有两个环境,我可以在其中测试这一个是使用EasyHP,另一个是使用WAMP 你们当中有人做过这件事吗 提前谢谢 最好的这里有人解释了其中的一些原因: 可悲的是,什么都没有,它不起作用。这件事

我正在尝试使用php连接到网络中共享的目录(类似于\remoteserver\mydir)。 我尝试了fopen函数,但它告诉我我没有连接的权限,因此该函数似乎到达了服务器,但无法访问目录,这是可以理解的,因为该函数在输入中没有获取凭据。 我还尝试将远程目录作为网络单元(Z:),但该功能仍然无法实现。目前我有两个环境,我可以在其中测试这一个是使用EasyHP,另一个是使用WAMP

你们当中有人做过这件事吗

提前谢谢
最好的

这里有人解释了其中的一些原因:


可悲的是,什么都没有,它不起作用。这件事真的快把我逼疯了。
// Define the parameters for the shell command
$location = "\\servername\sharename";
$user = "USERNAME";    
$pass = "PASSWORD";
$letter = "Z";

// Map the drive
system("net use ".$letter.": \"".$location."\" ".$pass." /user:".$user." /persistent:no>nul 2>&1");

// Open the directory
$dir = opendir($letter.":/an/example/path")