PHP/File Directory/basename

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

basename.php

 
<?php
   $path = "/home/www/data/users.txt";
   $filename = basename($path); 
   
   print $filename;
?>



Getting path components

 
<?php
$full_name = "/usr/local/php/php.ini";
$base = basename($full_name);  // $base is "php.ini"
$dir  = dirname($full_name);   // $dir is "/usr/local/php"
?>