PHP/File Directory/pathinfo

Материал из Web эксперт
Перейти к: навигация, поиск

Getting path components and file extensions

 
<?php
$info = pathinfo("/usr/local/php/php.ini");
echo $info["dirname"];
echo $info["basename"];
echo $info["extension"];
?>



pathinfo.php

 
<?php
   $pathinfo = pathinfo("data.txt");
   echo "Dir name: $pathinfo[dirname]<br />\n";
   echo "Base name: $pathinfo[basename] <br />\n";
   echo "Extension: $pathinfo[extension] <br />\n";
?>