怎么得到指定相对路径的绝对路径

WBOY
Release: 2016-06-13 13:53:24
Original
970 people have browsed it

如何得到指定相对路径的绝对路径
php 如何得到指定相对路径的绝对路径

相对路径是../new 
如何得到相对路径

------解决方案--------------------
realpath
------解决方案--------------------
$_SERVER['DOCUMENT_ROOT']可以知道站点的绝对路径
------解决方案--------------------
chdir('/var/www/');
echo realpath('./../../etc/passwd');
?> 

输出:/etc/passwd

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