🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## 删除字符串最后一个字符 ``` $str = 'a,2,3,4,5,'; dump(substr($str, 0, -1)); dump(rtrim($str, ",")); ``` ## 删除字符串最后的空格、换行 ``` $str = 'a,2,3,4,5, '; echo trim($str,", "); // 输出"a,2,3,4,5" ``` ## 删除字符串开始的空格、换行、制表符 ``` $str = ' a,2,3,4,5'; echo ltrim($str); // 输出"a,2,3,4,5" ```