迅睿CMS框架是一款PHP8高性能·簡單易用的CMS開源開發框架,基于MIT開源許可協議發布,免費且不限制商業使用,是免費開源的產品,以萬端互聯為設計理念,支持的微信公眾號、小程序、APP客戶端、移動端網站、PC網站等多終端式管理系統。
聯系官方銷售客服
1835022288
028-61286886
我需要,在pc端頁面,調用當前移動端頁面的url,是用哪個標簽,哪個大佬知道,謝謝!
http://www.zbshanke.com/doc/code/
PC模板顯示手機地址:{dr_rp($my_web_url, SITE_URL, SITE_MURL)}
手機模板顯示PC地址:{dr_rp($my_web_url, SITE_MURL, SITE_URL)}
回復@迅睿框架聯合創始人 你好,用這了簽標,生成內容,出現錯誤,我調用的標簽是這樣的,你看下,怎么調標簽
<meta http-equiv="mobile-agent" content="format=xhtml;url=需要當前移動端url">
<link rel="alternate" media="only screen and(max-width: 640px)" href="需要當前移動端url">
調用出現錯誤
<meta http-equiv="mobile-agent" content="format=xhtml;url={dr_rp($my_web_url, SITE_URL, SITE_MURL)}">
<link rel="alternate" media="only screen and(max-width: 640px)" href="{dr_rp($my_web_url, SITE_URL, SITE_MURL)}">
回復@liu888
為了問題能準確又快捷得解決,建議遵從以下操作
問題三連:
1、上代碼 (你的代碼);
2、上截圖 (錯誤信息提示截圖);
3、上鏈接 (你的問題所在鏈接);
pc頁面,在移動端打開時,跳轉到移動端頁面,這段js代碼,判斷調用當前移動端url出錯,請幫看下怎么調用這個移動端url,才正確
<script type="text/javascript">if(window.location.toString().indexOf('pref=padindex') != -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{str_replace(SITE_URL, SITE_MURL, $my_web_url)}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
回復@逆水行舟 你好,哪一個{后面加一個空格
回復@liu888 試試這個
<script type="application/javascript"> var MobileUA = (function() { var ua = navigator.userAgent.toLowerCase(); var mua = { IOS: /ipod|iphone|ipad/.test(ua), IPHONE: /iphone/.test(ua), IPAD: /ipad/.test(ua), ANDROID: /android/.test(ua), WINDOWS: /windows/.test(ua), TOUCH_DEVICE: ('ontouchstart' in window) || /touch/.test(ua), MOBILE: /mobile/.test(ua), ANDROID_TABLET: false, WINDOWS_TABLET: false, TABLET: false, SMART_PHONE: false }; mua.ANDROID_TABLET = mua.ANDROID && !mua.MOBILE; mua.WINDOWS_TABLET = mua.WINDOWS && /tablet/.test(ua); mua.TABLET = mua.IPAD || mua.ANDROID_TABLET || mua.WINDOWS_TABLET; mua.SMART_PHONE = mua.MOBILE && !mua.TABLET; if(ua.match(/MicroMessenger/i)=="micromessenger") { mua.SMART_PHONE = true; } return mua; }()); if (MobileUA.SMART_PHONE) { document.location.href = '{str_replace(SITE_URL, SITE_MURL, $my_web_url)}'; } </script>
http://www.zbshanke.com/doc/code/
PC模板顯示手機地址:{dr_rp($my_web_url, SITE_URL, SITE_MURL)}
手機模板顯示PC地址:{dr_rp($my_web_url, SITE_MURL, SITE_URL)}
回復@迅睿框架聯合創始人 你好,用這了簽標,生成內容,出現錯誤,我調用的標簽是這樣的,你看下,怎么調標簽
<meta http-equiv="mobile-agent" content="format=xhtml;url=需要當前移動端url">
<link rel="alternate" media="only screen and(max-width: 640px)" href="需要當前移動端url">
調用出現錯誤
<meta http-equiv="mobile-agent" content="format=xhtml;url={dr_rp($my_web_url, SITE_URL, SITE_MURL)}">
<link rel="alternate" media="only screen and(max-width: 640px)" href="{dr_rp($my_web_url, SITE_URL, SITE_MURL)}">
回復@liu888
為了問題能準確又快捷得解決,建議遵從以下操作
問題三連:
1、上代碼 (你的代碼);
2、上截圖 (錯誤信息提示截圖);
3、上鏈接 (你的問題所在鏈接);
pc頁面,在移動端打開時,跳轉到移動端頁面,這段js代碼,判斷調用當前移動端url出錯,請幫看下怎么調用這個移動端url,才正確
<script type="text/javascript">if(window.location.toString().indexOf('pref=padindex') != -1){}else{if(/AppleWebKit.*Mobile/i.test(navigator.userAgent) || (/MIDP|SymbianOS|NOKIA|SAMSUNG|LG|NEC|TCL|Alcatel|BIRD|DBTEL|Dopod|PHILIPS|HAIER|LENOVO|MOT-|Nokia|SonyEricsson|SIE-|Amoi|ZTE/.test(navigator.userAgent))){if(window.location.href.indexOf("?mobile")<0){try{if(/Android|Windows Phone|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)){window.location.href="{str_replace(SITE_URL, SITE_MURL, $my_web_url)}";}else if(/iPad/i.test(navigator.userAgent)){}else{}}catch(e){}}}}</script>
回復@逆水行舟 你好,哪一個{后面加一個空格
回復@liu888 試試這個