@zhutoulwz
2015-03-19T01:15:06.000000Z
字数 545
阅读 1493
php
path_info
文件处理
$path = "./image/me.jpg";
$path_info = pathinfo($path);
var_dump($path_info);
$basename = $path_info['basename'];
$ext = $path_info['extension'];
$dirname = $path_info['dirname'];
$filename = $path_info['filename'];
// 添加参数获取特定的值
$dir = pathinfo($path, PATHINFO_DIRNAME); //目录
$base = pathinfo($path, PATHINFO_BASENAME); //文件名(含扩展名)
$ext = pathinfo($path, PATHINFO_EXTENSION); //扩展名
$filename = pathinfo($path, PATHINFO_FILENAME); // 文件名(不含扩展名,PHP>5.2)
echo "<br/>";
echo $dir;
echo "<br/>";
echo $base;
echo "<br/>";
echo $ext;
echo "<br/>";
echo $filename;
echo "<br/>";
?>