note 117322 deleted from function.opendir by cmb
| From: | cmb@php.net | Date: | Tue, 11 Jun 2019 06:37:10 +0000 |
| Subject: | note 117322 deleted from function.opendir by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211215@lists.php.net to get a copy of this message | ||
Note Submitter: gothic dot javier at gmail dot com
----
About
// 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")
With apache in windows this is not working is needed to double all backslashes to work.
$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");
$dir = $letter.":/";
$dh = opendir($dir);
This worked for me.