下面的代码完美地工作:
$string = '(test1)';
$new = preg_replace('/^\(+.+\)+$/','word',$string);
echo $new;
输出:
word
如果代码是这样的:
$string = '(test1) (test2) (test3)';
如何生成输出: word word word?
梦里花落0921
相关分类