84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
项目中需要实现在某一段文本中获取到指定的字符串然后把获取到的字符对等替换成相对应的图片,例如:
<p>名族特色[pig_12] [pig_12] [pig_12][smiley_1] [smiley_1] [smiley_4] [smiley_6]</p>
如何获取到[pig_数字]和[[smiley_数字],然后把截取到的字符换成指定的图片?图片名称与截取到的字符串名称一样.
认证高级PHP讲师
'<p>名族特色[pig_12] [pig_12] [pig_12][smiley_1] [smiley_1] [smiley_4] [smiley_6]</p>'.replace(/\[(.+?)\]/g,'<img src="">')
认证高级PHP讲师