写法一:
{literal}
<script>
//判断是否手机自动跳转
var browser={versions:function(){var u=navigator.userAgent,app=navigator.appVersion;return{trident:u.indexOf("Trident")>-1,presto:u.indexOf("Presto")>-1,webKit:u.indexOf("AppleWebKit")>-1,gecko:u.indexOf("Gecko")>-1&&u.indexOf("KHTML")==-1,mobile:!!u.match(/AppleWebKit.*Mobile.*/),ios:!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),android:u.indexOf("Android")>-1||u.indexOf("Linux")>-1,iPhone:u.indexOf("iPhone")>-1,iPad:u.indexOf("iPad")>-1,webApp:u.indexOf("Safari")==-1}}(),language:(navigator.browserLanguage||navigator.language).toLowerCase()};if(browser.versions.mobile||browser.versions.ios||browser.versions.android||browser.versions.iPhone||browser.versions.iPad){window.location="http://3g.d1xz.net<?php echo request()->url(); ?>"};
</script>
{/literal}
写法二:
{literal}
<script>
//判断是否手机自动跳转
var isMobile = /Android|webOS|iPhone|iPad|BlackBerry/i.test(navigator.userAgent);
if(isMobile){window.location="http://m.xingzuo360.cn<?php echo request()->url(); ?>"};
</script>
{/literal}