我有一个连接到Linksys路由器的闪存驱动器(或硬盘驱动器),并将其设置为无需登录即可访问。然后我在计算机上设置了netword驱动器(Windows 7 Proffesional x64)。我试过opendir(\ 192.168.1.1);但是我收到了这个错误
Warning: opendir(\\192.168.1.1\s2,\\192.168.1.1\s2): The network name cannot be found. (code: 67) in C:\xampp\htdocs\movies.php on line 4
Warning: opendir(\\192.168.1.1\s2): failed to open dir: No such file or directory in C:\xampp\htdocs\movies.php on line 4
Warning: readdir() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\movies.php on line 5
然后我在php.net opendir评论中尝试了几个提示,但是当我尝试登录apache作为我的帐户时,我发现了错误:
Windows could not start the apache2.4 service on Local Computer Error 1069: The service did not start due to a logon failure.
PHP代码:
$path = '\\192.168.1.1\\s2';
$dir = opendir($path);
while($temp = readdir($dir))echo $temp;
编辑:我做了apache登录我为此专门创建的管理员帐户,但我仍然收到此错误:
Warning: opendir(\\192.168.1.1\s2\,\\192.168.1.1\s2\): The network name cannot be found. (code: 67) in C:\xampp\htdocs\movies.php on line 4
答案 0 :(得分:4)
\192.168.1.1
是网络共享的无效地址。你试过\\192.168.1.1
吗?
在这两种情况下,您都应该转义\
并将地址写为带引号的正确字符串。
此外,仅\\192.168.1.1
不是“有效文件夹”,您必须在此IP地址下指定其中一个网络共享。
话虽如此,您应该使用opendir("\\\\192.168.1.1\\share")
。