5

我有一段文字:

"2G Network":"GSM 850","3G Network":"HSDPA 850",

如何在php中删除文本末尾的“,”

"2G Network":"GSM 850","3G Network":"HSDPA 850"
4

2 回答 2

12

利用rtrim()

$str = rtrim($str, ',');
于 2012-06-07T04:53:05.993 回答
0

Substr()是你的朋友。

$noComma = substr('"2G Network":"GSM 850","3G Network":"HSDPA 850",', 0, -1);
于 2012-06-07T04:54:30.720 回答