Get the App
SLTechnology News&Howtos  ›  Development  › 

How php converts relative paths to absolute paths

Shulou Source: shulou.com Published: 2022-05-31 23:06:21 11月10日 Update

This article mainly explains "how php converts the relative path to the absolute path". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how php converts the relative path to the absolute path".

In PHP, you can use the realpath () function to convert a relative path to an absolute path, which returns an absolute path. This function removes all symbolic links and returns an absolute path name. On failure, the result is FALSE, and the syntax is "realpath".

This article operating environment: Windows10 system, PHP7.1 version, Dell G3 computer

How to convert relative path to absolute path by php

The realpath () function returns the absolute path.

This function removes all symbolic links (such as'/. /','/.. / 'and extra' /') and returns absolute pathnames.

If it fails, the function returns FALSE.

Grammar

Realpath (path)

Path is required. Specify the path to be checked.

Examples are as follows:

Output result:

Thank you for your reading, the above is the content of "how php converts the relative path to the absolute path". After the study of this article, I believe you have a deeper understanding of how php converts the relative path into the absolute path, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Path phase function learning content that is symbol result grammar path name function train of thought situation article more environment computer knowledge knowledge point example Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB Shulou Technology Huawei macOS Shulou Information