Home  >  Article  >  Backend Development  >  怎么得到指定相对路径的绝对路径

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

WBOY
WBOYOriginal
2016-06-13 10:05:36926browse

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

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

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

输出:/etc/passwd

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