php 截取某个字符串

$test = '/home/test/test.txt';
$result = substr($test,0,strrpos($test,"/"));
echo $result;
$number = '/home/test/test.txt';
$result = substr($number,strripos($number,"/")+1);
echo $result;

 

posted @ 2023-07-04 11:53  blog_zss小帅-博客猿  阅读(4)  评论(0编辑  收藏  举报