//去掉最后一个字符
$str = "1,2,3,4,5,6,"; $newstr = substr($str,0,strlen($str)-1); echo $newstr; ubstr($str, 0, -1)
//函数
rtrim($str, ",")
截取去掉第一个字符
<?php $a = "About us"; $a = substr($a,1); echo $a; ?>
//截取第一个字符
substr( $str, 0, 1 );
//去掉最后一个字符
$str = "1,2,3,4,5,6,"; $newstr = substr($str,0,strlen($str)-1); echo $newstr; ubstr($str, 0, -1)
//函数
rtrim($str, ",")
截取去掉第一个字符
<?php $a = "About us"; $a = substr($a,1); echo $a; ?>
//截取第一个字符
substr( $str, 0, 1 );
转载于:https://www.cnblogs.com/5aiQ/p/9454690.html