I am in the wamp environment. How can I make the opendir function of php accept the relative path?

Source: Internet
Author: User
Problem description: Requirement: if you do not want to expose local information, you can use the relative path for the opendir () function. My homework: I searched for a method to map local resources to a network driver using the netuse command of the system command line. {Code...} and such {code...} still have doubts... Problem description:
Requirement: If you want to avoid exposing local information, you can use the relative path for the opendir () function.
My homework: I searched for a method to map local resources to a network driver using the net use command of the system command line.

// Define the parameters for the shell command$location = "\\servername\sharename";$user = "USERNAME";$pass = "PASSWORD";$letter = "Z";// Map the drivesystem("net use ".$letter.": \"".$location."\" ".$pass." /user:".$user." /persistent:no>nul 2>&1");// Open the directory$dir = opendir($letter.":/an/example/path")

Also

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

Still have questions:
I still have a lot to understand about this method, so that I have never successfully started this service.
1. What is $ letter? The system prompts that I can only enter one character, otherwise it is not standard.
2 $ location required? In the future, if an independent host server is migrated, $ location should be reserved?
3. What is the account password? I am a local server with the address 127.0.0.1 or localhost. I have never set an account or password, but this is required.
I have no clue. Please give me a detailed answer.

Reply content:

Problem description:
Requirement: If you want to avoid exposing local information, you can use the relative path for the opendir () function.
My homework: I searched for a method to map local resources to a network driver using the net use command of the system command line.

// Define the parameters for the shell command$location = "\\servername\sharename";$user = "USERNAME";$pass = "PASSWORD";$letter = "Z";// Map the drivesystem("net use ".$letter.": \"".$location."\" ".$pass." /user:".$user." /persistent:no>nul 2>&1");// Open the directory$dir = opendir($letter.":/an/example/path")

Also

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

Still have questions:
I still have a lot to understand about this method, so that I have never successfully started this service.
1. What is $ letter? The system prompts that I can only enter one character, otherwise it is not standard.
2 $ location required? In the future, if an independent host server is migrated, $ location should be reserved?
3. What is the account password? I am a local server with the address 127.0.0.1 or localhost. I have never set an account or password, but this is required.
I have no clue. Please give me a detailed answer.

This is the SMB shared directory (that is, windows file and directory sharing). Here $ letter is the drive letter of Windows. You can enable the Guest account, which means that the guest password is not set as an empty string.

If you are worried about different deployed servers, you can write the IP address and path prefix to the configuration file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.