In PHP, you can use the realpath() function to convert a relative path to an absolute path. The function of this function is to return the absolute path. This function will delete all symbolic connections and return the absolute path name. If it fails, it will return The result is FALSE and the syntax is "realpath (relative path)".
The operating environment of this article: Windows 10 system, PHP version 7.1, Dell G3 computer
How to convert relative path to absolute path in php
realpath() function returns the absolute path.
This function removes all symbolic links (such as '/./', '/../' and redundant '/') and returns the absolute path name.
If it fails, this function returns FALSE.
Syntax
realpath(path)
path Required. Specifies the path to be checked.
The example is as follows:
<?php echo realpath("1118.02.png"); ?>
Output result:
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to convert relative path to absolute path in php. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

SublimeText3 Chinese version
Chinese version, very easy to use

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
