日期:2014-05-17 浏览次数:20475 次
$string = <<<str …………………… <img src="/img/pvistely/1.jpg" /> <img src="/img/pvistely/2.jpg" /> <img src="/img/pvistely/3.jpg" /> …………………… str; $pattern = array('<img src="/img/pvistely/1.jpg" />','<img src="/img/pvistely/2.jpg" />','<img src="/img/pvistely/3.jpg" />'); $replace = array('[img]1.jpg[/img]','[img]2.jpg[/img]','[img]3.jpg[/img]'); echo preg_replace($pattern, $replace, $string);
…………………… <[img]1.jpg[/img]> <[img]2.jpg[/img]> <[img]3.jpg[/img]> ……………………