<?<span>php
</span><span>
</span><span>
{
</span><span>
if
</span> (<span>isset</span>(<span>
$_SERVER
</span>[
'HTTP_VIA'
])) <span>
return
</span><span>true</span><span>;
</span><span>
if
</span> (<span>isset</span>(<span>
$_SERVER
</span>[
'HTTP_X_NOKIA_CONNECTION_MODE'
])) <span>
return
</span><span>true</span><span>;
</span><span>
if
</span> (<span>isset</span>(<span>
$_SERVER
</span>[
'HTTP_X_UP_CALLING_LINE_ID'
])) <span>
return
</span><span>true</span><span>;
</span><span>
if
</span> (<span>
strpos
</span>(<span>
strtoupper
</span>(<span>
$_SERVER
</span>[
'HTTP_ACCEPT'
]),
"VND.WAP.WML"
) > 0<span>) {
</span><span>
} </span><span>
else
</span><span> {
</span><span>
$browser
</span> = <span>isset</span>(<span>
$_SERVER
</span>[
'HTTP_USER_AGENT'
]) ? <span>trim</span>(<span>
$_SERVER
</span>[
'HTTP_USER_AGENT'
]) :
''
<span>;
</span><span>
if
</span> (<span>
empty
</span>(<span>
$browser
</span>)) <span>
return
</span><span>true</span><span>;
</span><span>
$clientkeywords
</span> = <span>
array
</span><span>(
</span>
'nokia'
,
'sony'
,
'ericsson'
,
'mot'
,
'samsung'
,
'htc'
,
'sgh'
,
'lg'
,
'sharp'
,
'sie-'
,
'philips'
,
'panasonic'
,
'alcatel'
,
'lenovo'
,
'iphone'
,
'ipod'
,
'blackberry'
,
'meizu'
,
'android'
,
'netfront'
,
'symbian'
,
'ucweb'
,
'windowsce'
,
'palm'
,
'operamini'
,
'operamobi'
,
'opera mobi'
,
'openwave'
,
'nexusone'
,
'cldc'
,
'midp'
,
'wap'
,
'mobile'
<span> );
</span><span>
if
</span> (<span>preg_match</span>(
"/("
. <span>implode</span>(
'|'
, <span>
$clientkeywords
</span>) .
")/i"
, <span>
$browser
</span>) && <span>
strpos
</span>(<span>
$browser
</span>,
'ipad'
) === <span>false</span><span>) {
</span><span>
$br
</span> =
"WML"
<span>;
} </span><span>
else
</span><span> {
</span><span>
$br
</span> =
"HTML"
<span>;
}
}
</span><span>
if
</span> (<span>
$br
</span> ==
"WML"
<span>) {
</span><span>
return
</span><span>TRUE</span><span>;
} </span><span>
else
</span><span> {
</span><span>
return
</span><span>FALSE</span><span>;
}
}
</span>?><br>然后在phpcms/templates/
default
模版文件夹里建立一个文件夹存放手机站的模版<br>我建立一个叫mobile的文件夹<br>然后修改