我有这样的字符串
$string ="this is test {username} ,{password@123} and Other {asdfg@#$}"
我想要这个字符串作为数组格式如下
[1] => Array
(
[0] => username
[1] => password@123
[2] => asdfg@#$
)
$re = "/\{(.*?)\}/";
$str = "this is test {username} ,{password@123} and Other {asdfg@#\$}";
preg_match_all($re, $str, $matches);
print_r($matches);
这给你想要的
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句