Heim  >  Artikel  >  php教程  >  realpath自动清除路径中的点号

realpath自动清除路径中的点号

WBOY
WBOYOriginal
2016-06-06 20:13:58823Durchsuche

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)
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn