PHP获取文件绝对路径

WBOY
Release: 2016-06-23 14:03:43
Original
1273 people have browsed it

已知文件 根路径“/images/test.jpg”
我想要通过这个路径获取它的物理路径或者说是相对路径怎么弄

????求大侠帮助。在线等.


回复讨论(解决方案)

在文件系统里
/images/test.jpg
已然是 物理路径 了

如果是 url ,那么
$_SERVER['DOCUMENT_ROOt'] . '/images/test.jpg'
就是 绝对路径

至于你说的“相对路径”,因为你并没有给出参照点,所以也就无所谓“相对”了

E:\wwwroot\bifoli/images/test.jpg 

realpath

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