时间:2021-07-01 10:21:17 帮助过:3人阅读
$str = "fsafsaf<{0}>54a<{1}>u7ygda<{2}>kklaoda<{3}>"; $char = array('a1','a2','a3','a4'); $pattern = '/<\{(\d*)\}>/'; $replacement = '$char[\\1]'; $newstr = preg_replace($pattern,$replacement,$str); echo $newstr;
$pattern = '/<\{(\d*)\}>/ e';
$pattern = '/<\{(\d*)\}>/ e';
非常感谢,这样写可以了,可以问下加个 e 代表什么意思吗
eval 计算表达式串
eval 计算表达式串
明白了,再次感谢!!