迅睿開源框架是一款PHP8高性能·簡(jiǎn)單易用的PHP開源開發(fā)框架, 基于MIT開源許可協(xié)議發(fā)布,不限制商業(yè)使用,以多端互聯(lián)為設(shè)計(jì)理念, 支持的微信公眾號(hào)、小程序、APP客戶端、移動(dòng)端網(wǎng)站、PC網(wǎng)站等多終端式管理系統(tǒng)。
業(yè)務(wù)經(jīng)理
微信掃描以上二維碼
028-61286886
技術(shù)咨詢
之前織夢(mèng)搭建的網(wǎng)站,模板使用了mip的,沒有分手機(jī)端和PC端,然后都可以正常顯示
現(xiàn)在轉(zhuǎn)迅睿了,然后建的PC,模板也轉(zhuǎn)成迅睿的了,然后圖片顯示不出來(lái)了,我把<mip-img src=""></mip-img>的代碼換成<img src="" />后PC端就可以顯示了,但是手機(jī)端又不能同比例縮放了
各位大佬,有什么解決辦法么?
我是小白一枚,只會(huì)粗淺的一點(diǎn)代碼!?。。?!
http://m.apdwn.com/wenda/43619.html
往下拉,手機(jī)端圖片問題
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(fù)迅睿框架創(chuàng)始人 沒有可以解決的答案,大佬,因?yàn)槲蚁氚芽棄?mèng)網(wǎng)轉(zhuǎn)到迅睿,鏈接不要變,所以我在迅睿里面沒有建手機(jī)站的,只建PC站,然后現(xiàn)在使用MIP的話,就顯示不出圖片,不使用MIP的話,手機(jī)打開網(wǎng)站圖片不會(huì)自動(dòng)縮放
回復(fù)@csmaliya 試試這樣
1、打開 config/custom.php 加入
/**
* MIP文章內(nèi)容頁(yè)圖片適配百度MIP規(guī)范
*
* @access public
* @param string $content 文章內(nèi)容
* @return string
*/
if(!function_exists('mip'))
{
function mip($content){
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/', SITE_URL.'/uploads/', $content);
return $content;
2、內(nèi)容模板調(diào)用標(biāo)簽
{$content}
改成
{mip($content)}
回復(fù)@云畔設(shè)計(jì) 那MIP不用去動(dòng)么?只要把圖片路徑替換成絕對(duì)路徑就可以了么?不用加手機(jī)端的模板么?
回復(fù)@LandQ 好的,我試試,感謝大佬
回復(fù)@云畔設(shè)計(jì) 好的,感謝大佬,我先試試,得重裝下迅睿才行,被我改的不成樣子了,汗 ?? ?? ??
http://m.apdwn.com/wenda/43619.html
往下拉,手機(jī)端圖片問題
開源是一種精神,但不是義務(wù),幫忙是情分,不幫也不要抱怨,建議大家多研究代碼、多閱讀代碼、多翻閱社區(qū)歷史問題!
回復(fù)迅睿框架創(chuàng)始人 沒有可以解決的答案,大佬,因?yàn)槲蚁氚芽棄?mèng)網(wǎng)轉(zhuǎn)到迅睿,鏈接不要變,所以我在迅睿里面沒有建手機(jī)站的,只建PC站,然后現(xiàn)在使用MIP的話,就顯示不出圖片,不使用MIP的話,手機(jī)打開網(wǎng)站圖片不會(huì)自動(dòng)縮放
回復(fù)@csmaliya 試試這樣
1、打開 config/custom.php 加入
/**
* MIP文章內(nèi)容頁(yè)圖片適配百度MIP規(guī)范
*
* @access public
* @param string $content 文章內(nèi)容
* @return string
*/
if(!function_exists('mip'))
{
function mip($content){
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/', SITE_URL.'/uploads/', $content);
return $content;
}
}
2、內(nèi)容模板調(diào)用標(biāo)簽
{$content}
改成
{mip($content)}
回復(fù)@云畔設(shè)計(jì) 那MIP不用去動(dòng)么?只要把圖片路徑替換成絕對(duì)路徑就可以了么?不用加手機(jī)端的模板么?
回復(fù)@LandQ 好的,我試試,感謝大佬
回復(fù)@云畔設(shè)計(jì) 好的,感謝大佬,我先試試,得重裝下迅睿才行,被我改的不成樣子了,汗 ?? ?? ??