PHP/File Directory/File
Версия от 10:37, 26 мая 2010; (обсуждение)
dirname: get the directory name for a file
<?php
$path = "./test.txt";
$dirname = dirname($path);
echo $dirname;
?>
File base name
<?php
$path = "./test.txt";
$filename = basename($path);
$filename2 = basename($path, ".txt");
echo $filename;
echo "<BR>";
echo $filename2;
?>
realpath: Returns canonicalized absolute pathname
<?php
$imgPath = "./text.txt";
$absolutePath = realpath($imgPath);
echo $absolutePath;
?>