php获取指定路径的最后一个参数,可能是文件名或者最后一层文件夹
function path_get_last_arg($path){ $path = str_replace('\\', '/', $path); $path = preg_replace('/\/+$/', '', $path); $path = explode('/', $path); $l = count($path)-1; return isset($path[$l]) ? $path[$l] : ''; }
php获取指定路径的最后一个参数,可能是文件名或者最后一层文件夹
function path_get_last_arg($path){ $path = str_replace('\\', '/', $path); $path = preg_replace('/\/+$/', '', $path); $path = explode('/', $path); $l = count($path)-1; return isset($path[$l]) ? $path[$l] : ''; }