<?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
求更简便的正则替换 , 最好一行搞定 ☺
qq_青枣工作室_0