有没有办法从完整路径获取文件名?

时间:2012-08-14 19:55:08

标签: php file

  

可能重复:
  How to get file name from full path with PHP?

文件路径:

users_gallery/2012/August/14-August-2012/8/Sasasas/b_80.27016000 134489509114 08 2012kites-4v.jpg

我有办法取出文件名:

b_80.27016000 134489509114 08 2012kites-4v.jpg

2 个答案:

答案 0 :(得分:0)

答案 1 :(得分:-1)

$arr = explode('/', 'users_gallery/2012/August/14-August-2012/8/Sasasas/b_80.27016000 134489509114 08 2012kites-4v.jpg');
$file = $arr[count($arr) - 1];
echo $file;

这应该回应b_80.27016000 134489509114 08 2012kites-4v.jpg