时间:2021-07-01 10:21:17 帮助过:30人阅读
str_replace(",","",str_replace("|","",$val)) 替换即可
$s = "1|10,2|11,3|12";echo preg_replace('/\|[^,]+,/', ',', $s);1,2,3|12
结果是110211,我要的结果是1|10,2|11,3|12 变成1,2,3 拜托!
如何再去掉|12变成1,2,3呢?
$content = '1|10,2|11,3|12';echo preg_replace(array('/\|[^,]+,/','/\|[^,]+$/'), array(',',''), $content);
$s = "1|10,2|11,3|12";echo preg_replace('/\|[^,]+/', '', $s);1,2,3
谢谢,结贴!