$str = "1,2,3,4,5,"; $newstr = substr($str,0,strlen($str)-1); echo $newstr; //echo 1,2,3,4,5 方法二: rtrim($str, ",")