求php大神帮帮忙 这段字符串怎么处理·
$str = "http://www.test.com/imges/1.jpg--1,http://www.test.com/imges/3.jpg--2,http://www.test.com/imges/3.jpg--3";
我想要的结果 不知道怎么写正则
$str1 = "http://www.test.com/imges/1.jpg,http://www.test.com/imges/3.jpg,http://www.test.com/imges/3.jpg";
$str2 = "1,2,3";
求高手帮帮忙
------解决方案--------------------
$str = "http://www.test.com/imges/1.jpg--1,http://www.test.com/imges/3.jpg--2,http://www.test.com/imges/3.jpg--3";$str1= preg_replace('/--(\d+)/','',$str);preg_match_all('/--(\d+)/',$str,$m);$str2=join(',',$m[1]);<div class="clear"></div>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号