日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

dedecmsmip_织梦MIP文章内容页图片适配百度MIP规范

發布時間:2024/9/27 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 dedecmsmip_织梦MIP文章内容页图片适配百度MIP规范 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

不用修改程序內核文件,不影響電腦站和手機站文章內容頁的文章內容輸出,增加個自定義方法來解決織夢MIP文章內容頁圖片適配百度MIP規范

操作步驟

width|height 去除圖片寬高

style 去除內聯樣式

/uploads/ 相對路徑圖片路徑替換成絕對路徑

打開 /include/extend.func.php 在最下面加入個方法

/**

* MIP文章內容頁圖片適配百度MIP規范

*

* @access public

* @param string $content 文章內容

* @return string

*/

function mip($content){

global $cfg_basehost;

preg_match_all('//', $content, $images);

if(!is_null($images)) {

foreach($images[1] as $index => $value){

$mip_img = str_replace('

$mip_img = str_replace('>', '>', $mip_img);

$mip_img = preg_replace('/(width|height)="\d*"\s/', '', $mip_img );

$mip_img = preg_replace('/ style=\".*?\"/', '',$mip_img);

$content = str_replace($images[0][$index], $mip_img, $content);

}

}

preg_match_all('/ style=\".*?\"/', $content, $style);

if(!is_null($style)) {

foreach($style[0] as $index => $value){

$mip_style = preg_replace('/ style=\".*?\"/', '',$style[0][$index]);

$content = str_replace($style[0][$index], $mip_style, $content);

}

}

$content = str_replace('/uploads/', $cfg_basehost.'/uploads/', $content);

return $content;

}

內容頁模板標簽寫法

{dede:field.bodyfunction=mip(@me)/}

總結

以上是生活随笔為你收集整理的dedecmsmip_织梦MIP文章内容页图片适配百度MIP规范的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。