PHP怎么删除字符串中的指定字符,高手来帮忙看一下
1个回答
展开全部
删除第四个参数吗,示例代码:
<?php
$a='rgba(255,255,255,1) rgba(1,10,100,0.1) rgba(1,10,100,10.123) rgba(1,10,100,-123.001)';
$a=<a href="https://www.baidu.com/s?wd=preg_replace&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Ydn1PhrjbsuWf4uHFhnHbz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHRknWDYrj61PW0Ln1bknWDsn0" target="_blank" class="baidu-highlight">preg_replace</a>('/,[0-9\.\-]*\)/',')',$a);
echo $a;
?>
执行结果:
rgba(255,255,255) rgba(1,10,100) rgba(1,10,100) rgba(1,10,100)
<?php
$a='rgba(255,255,255,1) rgba(1,10,100,0.1) rgba(1,10,100,10.123) rgba(1,10,100,-123.001)';
$a=<a href="https://www.baidu.com/s?wd=preg_replace&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Ydn1PhrjbsuWf4uHFhnHbz0ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHRknWDYrj61PW0Ln1bknWDsn0" target="_blank" class="baidu-highlight">preg_replace</a>('/,[0-9\.\-]*\)/',')',$a);
echo $a;
?>
执行结果:
rgba(255,255,255) rgba(1,10,100) rgba(1,10,100) rgba(1,10,100)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询