Home > Common Problem > body text

Accessing files using relative paths starts with accessing files by directory?

青灯夜游
Release: 2020-08-29 11:28:47
Original
8403 people have browsed it

Using relative paths to access files is to access files by directory starting from the "current directory". A relative path is a path starting from the current path and refers to the path relationship with other files (or folders) caused by the path where this file is located.

Accessing files using relative paths starts with accessing files by directory?

Absolute path and relative path

Absolute path:

is the path starting from the drive letter, in the form of

C:\windows\system32\cmd.exe
Copy after login

Relative path:

is the path starting from the current path, if the current path is C:\windows

To describe the above path, just enter

system32\cmd.exe
Copy after login

In fact, the strict relative path writing should be .\system32\cmd.exe

Among them, . represents the current path, which can be omitted in the case of channels, but cannot be omitted only in special circumstances.

If the current path is c:\program files

To call the above command, you need to enter

..\windows\system32\cmd.exe
Copy after login

where, .. is the parent directory.

If the current path is c:\program files\common files

, you need to enter

..\..\windows\system32\cmd.exe
Copy after login

In addition, there is also a path that does not include a drive letter Special absolute path, in the form of

\windows\system32\cmd.exe
Copy after login

No matter what the current path is, it will automatically search for the specified program starting from the root directory of the current disk.

For more related knowledge, please visit: PHP Chinese website!

The above is the detailed content of Accessing files using relative paths starts with accessing files by directory?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
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!