时间:2021-07-01 10:21:17 帮助过:4人阅读
$str=$content;
$count=preg_match_all('/\[img\](.*?)\[\/img\]/i',$str,$match, PREG_SET_ORDER);
if($count>0){
for($i=0;$i<$count;$i++){
// echo $match[$i][0].","https://www.gxlcms.com/.$match[$i][1]."
";
$str1="
";
//echo $str1.$match[$i][0];
$str = str_replace($match[$i][0], $str1, $str);
}
$bodytag=$str;
} else {
$bodytag=$str;
}
$count=preg_match_all('/\[url\ssrc=(((ht){1}tp://)[-a-zA-Z0-9@:%_/+.~#?&//=]+)\](.*?)\[\/url\]/i',$bodytag,$match, PREG_SET_ORDER);
if($count>0){
for($i=0;$i$str2="".$match[$i][4]."";
$bodytag = str_replace($match[$i][0], $str2, $bodytag);
}
$bodytag1 =$bodytag;
} else {
$bodytag1 =$bodytag;
}
echo $bodytag1;
//echo $content;
?>