<?php
$aa=',16,,21,authAdd,19,authList,,,22,goodsList,23,goodsAdd,17,,24,roleList,25,roleAdd,26,,60,loglog,61,adminAdd,62,adminList';
$aa = preg_replace('/,(\p{L}+)/', '', $aa);
$aa = preg_replace('/^,/', '', $aa);
$aa = preg_replace('/,+/', ',', $aa);
var_dump($aa); // 16,21,19,22,23,17,24,25,26,60,61,62求更简便的正则替换 , 最好一行搞定 ☺
3 回答
qq_青枣工作室_0
TA贡献446条经验 获得超754个赞
<?php $aa=',16,,21,authAdd,19,authList,,,22,goodsList,23,goodsAdd,17,,24,roleList,25,roleAdd,26,,60,loglog,61,adminAdd,62,adminList'; $aa = trim(preg_replace('/[^\d]+/', ',', $aa), ','); echo $aa; // 16,21,19,22,23,17,24,25,26,60,61,62
- 3 回答
- 0 关注
- 1725 浏览
添加回答
举报
0/150
提交
取消