search
HomeBackend DevelopmentPHP ProblemHow to convert relative path to absolute path in php

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)".

How to convert relative path to absolute path in php

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:

How to convert relative path to absolute path in php

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!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool