独立字符串逗号
答
$string=" Tag tag1 tag2";
print implode(',',explode(' ',trim($string)));
//or
print str_replace(' ',',',trim($string));
//or
print preg_replace('#()#',',',trim($string));
爆炸,内爆,完成。 – CBroe
^只是想说;打败了我。 –
使用[str_replace](http://php.net/manual/en/function.str-replace.php)如果它们始终由相同的字符分隔。 – KhorneHoly