php去掉字符串最后一个逗号

str="1,2,3,4,5,";结果:1,2,3,4,5
2025-03-20 03:13:36
推荐回答(1个)
回答1:

$str="1,2,3,4,5,";
$list = rtrim($str, ',');