Home  >  Article  >  php教程  >  realpath自动清除路径中的点号

realpath自动清除路径中的点号

WBOY
WBOYOriginal
2016-06-06 20:13:58853browse

realpath自动清除路径中的点号,但仅限与点号出现在目录名和目录符号中间的情况。 php echo realpath('/var/www/test/constant../../array/');/var/www/test/arrayphp echo realpath('/var/www/test/constant./../array/');/var/www/test/arrayphp echo realp

realpath自动清除路径中的点号,但仅限与点号出现在目录名和目录符号中间的情况。

php > echo realpath('/var/www/test/constant../../array/');
/var/www/test/array
php > echo realpath('/var/www/test/constant./../array/');
/var/www/test/array
php > echo realpath('/var/www/test/constant/../array/');
/var/www/test/array
php > var_dump(realpath('/var/www/test/constan.t/../array/'));
bool(false)
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