function replace_content($title,$newstext){
$newstext = stripcslashes($newstext);
$imgRegex='/<\s*img[\s\S]+?(?:src=[\'"]([\S\s]*?)[\'"]\s*|alt=[\'"]([\S\s]*?)[\'"]\s*|[a-z]+=[\'"][\S\s]*?[\'"]\s*)+[\s\S]*?>/i';
$str = preg_replace($imgRegex,'<img class="lazy" data-src="$1" alt="$2" title="$2" width="100%" alt="$2" style="margin:8px 0">',$newstext);
return $str;
}
该内容有帮助吗?Was this helpful?
- linhuimingok@qq.com
- linhuimingok@gmail.com
欢迎交个朋友……
Feel free to connect and make a new friend!
微信二维码 WeChat QR Code