時(shí)間:2023-06-06 17:15:01 | 來(lái)源:網(wǎng)站運(yùn)營(yíng)
時(shí)間:2023-06-06 17:15:01 來(lái)源:網(wǎng)站運(yùn)營(yíng)
源起網(wǎng)源碼模板 織夢(mèng)內(nèi)容頁(yè)圖片適配百度MIP規(guī)范:源起網(wǎng)源碼模板 織夢(mèng)內(nèi)容頁(yè)圖片適配百度MIP規(guī)范/**內(nèi)容頁(yè)模板標(biāo)簽寫法
* MIP文章內(nèi)容頁(yè)圖片適配百度MIP規(guī)范
*
* @access public
* @param string $content 文章內(nèi)容
* @return string
*/
function mip($content){
global $cfg_basehost;
preg_match_all('/<img (.*?)/>/', $content, $images);
if(!is_null($images)) {
foreach($images[1] as $index => $value){
$mip_img = str_replace('<img', '<mip-img', $images[0][$index]);
$mip_img = str_replace('>', '></mip-img>', $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.body function=mip(@me)/}
源起網(wǎng)源碼模板 織夢(mèng)內(nèi)容頁(yè)圖片適配百度MIP規(guī)范
關(guān)鍵詞:規(guī)范,圖片,內(nèi)容,模板
客戶&案例
營(yíng)銷資訊
關(guān)于我們
客戶&案例
營(yíng)銷資訊
關(guān)于我們
微信公眾號(hào)
版權(quán)所有? 億企邦 1997-2025 保留一切法律許可權(quán)利。