请问php如何批量更换html中img图片的src地址为压缩地址?
网友回复
正则匹配
<?php
/**
* 图片地址替换成压缩URL
* @param string $content 内容
* @param string $suffix 后缀
*/
function get_img_thumb_url($content = "", $suffix = "?x-oss-process=image/auto-orient,1/resize,m_fill,w_100,h_100,/quality,q_90") {
$pregRule = "/<[img|IMG].*?src=[\'|\"](.*?(?:[\.jpg|\.jpeg|\.png...点击查看剩余70%


