正则批量轮换

WBOY
Release: 2016-06-13 12:52:07
Original
977 people have browsed it

正则批量替换
$str =' 正则批量轮换  正则批量轮换 '

如何批量将src前面加个域名呢

$str =' 正则批量轮换  正则批量轮换 '


------解决方案--------------------
引用:
引用:$str = ' 正则批量轮换  正则批量轮换 ';
$str = str_replace('src="', 'src="http://www.xxx.com/', $str);
echo $……


能不用则不用 这是原则...

<br />
$str = '<img  src="test/aaa/a.jpg" widht=33 height=3 alt=" 正则批量轮换 " ><img  src="f/aaa/a.jpg" widht=4 height=3 alt=" 正则批量轮换 " >';<br />
echo preg_replace('/(src=")/', "$1'http://www.xxx.com/", $str);<br />
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