Home > Backend Development > PHP Tutorial > PHP 批量替换内容

PHP 批量替换内容

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-23 14:13:45
Original
1576 people have browsed it

PHP

需要替换的内容:{1_EXP}{2_EXP}{3_EXP}{4_EXP}{5_EXP}{5_EXP}...

需要替换成:PHP 批量替换内容

例如:
{0_EXP} = PHP 批量替换内容
{1_EXP} = PHP 批量替换内容
{2_EXP} = PHP 批量替换内容
...

PHP:
$row['msg'] = str_replace(表达式, 'PHP 批量替换内容', $mycn['msg']);

什么写?还有其他更好的方法不?



回复讨论(解决方案)

$s='{1_EXP}{2_EXP}{3_EXP}{4_EXP}{5_EXP}{5_EXP}';echo preg_replace('/\{(\d+)_EXP\}/','<img  src="http://localhost/images/$1.gif" / alt="PHP 批量替换内容" >',$s);
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template