我是wamp环境,怎么样让php的opendir函数可以接受相对路径?
迷茫
迷茫 2017-04-10 17:53:11
0
1
566

问题描述:
需求:希望不暴露本地信息,所以想opendir()函数可以接受相对路径。
做过的功课:搜索过一个使用系统命令行的net use 指令将本地资源映射为网络驱动的方法。

// 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")

还有这样的

system('net use K: \\192.168.10.10\pictures /user:username password /persistent:no');
$share = opendir('\\\\192.168.10.10\\pictures);

依旧存在疑问:
这个方法我还有很多不明白的地方,以至于从未成功开启过这个服务。
1这个$letter是什么?系统提示我只能填一个字符,否则不规范。
2$location怎么填?以及将来如果搬上独立主机服务器了,$location又该怎么填?
3账号密码是什么?我是一个本地服务器,地址就是127.0.0.1,或者叫localhost,从来没有设置过账号密码,但是这又是必填项。
我全无头绪,还请大家帮忙详细解答一下。

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!