在iPhone下,返回
Mozilla/5.0 (iPhone; CPU iPhone OS 5_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9B176 MicroMessenger/4.3.2
在Android下,返回
Mozilla/5.0 (Linux; U; Android 2.3.6; zh-cn; GT-S5660 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1 MicroMessenger/4.5.255
不难发现微信浏览器为 MicroMessenger ,并且有版本号,也可以判断手机类型为iPhone还是Android
如果要做盗链
if(strpos($_SERVER["HTTP_USER_AGENT"],"MicroMessenger")) echo "Welcome to wechat word"; else echo "http/1.1 401 Unauthorized";