protected function isphone(){
$agent = strtolower($_server['http_user_agent']);
//pc请求头信息数组
$pc_arr=array('windows nt','macintosh','ipad','baiduspider','spider');
//如确认为移动端则更改默认值
//没找到pc数组元素时判断为移动端
foreach($pc_arr as $k => $v){
$pc=strpos($agent, $v) ? true : false;
if($pc){
return false;
}
}
return true;
}
/**
* 判断是否微信
* liangzheng 2014-12-03
*/
protected function is_weixin(){
if ( strpos($_server['http_user_agent'], 'micromessenger') !== false ) {
return true;
}
return false;
}
以上就是php如何判断是否isphone和is_weixin的实例的详细内容。