Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这样的图像路径..
2012/12/14/example.jpg
现在我想获取除图像名称之外的路径..
我的意思是我需要这样
2012/12/14/
谁能帮我?谢谢
我想这就是你需要的
<?php $path_parts = pathinfo('2012/12/14/example.jpg'); echo $path_parts['dirname'], "\n"; echo $path_parts['basename'], "\n"; echo $path_parts['extension'], "\n"; echo $path_parts['filename'], "\n"; ?>
输出将是..
/www/htdocs/inc example.jpg jpg example