标签:style blog http color os div log sp c
// 判断是移动端还是PC端 $http_user_agent = isset($_SERVER[‘HTTP_USER_AGENT‘]) ? strtolower($_SERVER[‘HTTP_USER_AGENT‘]): ‘‘; $http_accept = isset($_SERVER[‘HTTP_ACCEPT‘]) ? strtolower($_SERVER[‘HTTP_ACCEPT‘]): ‘‘; $pos_hua = strpos($http_user_agent, ‘mobi‘); $pos_a_wap = strpos($http_accept, ‘wap‘); $pos_a_wml = strpos($http_accept, ‘wml‘); if($pos_hua !== FALSE) { echo ‘Mobile‘;//exit; } elseif($pos_a_wap !== FALSE) { echo ‘Mobile‘;//exit; } elseif($pos_a_wml !== FALSE) { echo ‘Mobile‘;//exit; } else { echo ‘PC‘; }
标签:style blog http color os div log sp c
原文地址:http://www.cnblogs.com/huidaoli/p/3941331.html