$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 = '// e';
$pattern = '// e';
非常感谢,这样写可以了,可以问下加个 e 代表什么意思吗
eval 计算表达式串
eval 计算表达式串
明白了,再次感谢!!