没人回复我自己来吧,直接替换文章内容图片路径,其中$eyou['global']['web_basehost']就是$eyou.global.web_basehost{php} $str = $eyou['field']['content']; $search = '/(<img.*?)width=(["\\'])?.*?(?(2)\\2|\\s)([^>]+>)/is'; $search1 = '/(<img.*?)height=(["\\'])?.*?(?(2)\\2|\\s)([^>]+>)/is'; $search2 = '#(<img.*?style=".*?)width:\\d+px;([^"]*?.*?>)#i'; $search3 = '#(<img.*?style=".*?)height:\\d+px;([^"]*?.*?>)#i'; $content = preg_replace($search,'$1$3',$str); $content = preg_replace($search1,'$1$3',$content); $content = preg_replace($search2,'$1$2',$content); $content = preg_replace($search3,'$1$2',$content); $content = str_replace('/uploads/', $eyou['global']['web_basehost'].'/uploads/', $content); echo $content; {/php}