原字符串1,2,3,4,5,6, 去掉最后一个字符",",最终结果为1,2,3,4,5,6 代码如下: $str = "1,2,3,4,5,6,"; $newstr = substr($str,0,strlen($str)-1); echo $newstr; //echo 1,2,3,4,5,6 系统自带的函数即可实现这样的效果,两种方法: 1) substr($str, 0, -1) 2)rtrim($str, ",") 摘自 〃Style ひぐ http://www.bkjia.com/PHPjc/478188.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/478188.htmlTechArticle原字符串1,2,3,4,5,6, 去掉最后一个字符,,最终结果为1,2,3,4,5,6 代码如下: $str = 1,2,3,4,5,6,; $newstr = substr($str,0,strlen($str)-1); echo $newstr; //echo 1...