迅睿CMS框架是一款PHP8高性能·簡單易用的CMS開源開發(fā)框架,基于MIT開源許可協(xié)議發(fā)布,免費且不限制商業(yè)使用,是免費開源的產(chǎn)品,以萬端互聯(lián)為設計理念,支持的微信公眾號、小程序、APP客戶端、移動端網(wǎng)站、PC網(wǎng)站等多終端式管理系統(tǒng)。
聯(lián)系官方銷售客服
1835022288
028-61286886
上面圖一中域名模式的手機站在 列表頁調用縮略圖時路徑是直接取的電腦站的圖片;
但在下面圖二中 在內(nèi)容頁 文章正文中 圖片的路徑卻是 手機站的,麻煩指引解答下具體是啥原因;
最終需求就是手機站調用縮略圖及內(nèi)容頁正文中的圖片路徑都是像圖一那樣直接調用電腦站路徑下圖片:http://kh022.xxxxxxx.com/uploads/200629/1-200629104059401.jpg
打開 config/custom.php 添加自定義函數(shù)
/* * 織夢轉迅睿后二級域名手機站內(nèi)容圖片去寬高自適應+絕對路徑 * @param string $body * @return string 返回內(nèi)容 */ if(!function_exists('resetBody')) { function resetBody($body) { $search = '/(<img.*?)width=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is'; $search1 = '/(<img.*?)height=(["\'])?.*?(?(2)\2|\s)([^>]+>)/is'; $search2 = '#(<img.*?style=".*?)width:\s{0,}\d+px;([^"]*?.*?>)#i'; $search3 = '#(<img.*?style=".*?)height:\s{0,}\d+px;([^"]*?.*?>)#i'; $content = preg_replace($search, '$1$3', $body); $content = preg_replace($search1, '$1$3', $content); $content = preg_replace($search2, '$1$2', $content); $content = preg_replace($search3, '$1$2', $content); $result = str_replace('/uploads/', SITE_URL . '/uploads/', $content); return $result; } }
模板調用文檔內(nèi)容標簽
{$content}
改成
{resetBody($content)}
就可以了
回復@LandQ 感謝指引解答,已經(jīng)解決
打開 config/custom.php 添加自定義函數(shù)
模板調用文檔內(nèi)容標簽
{$content}
改成
{resetBody($content)}
就可以了
回復@LandQ 感謝指引解答,已經(jīng)解決