在js或php中获取类似[[UIDevice currentdevice]name]的电话名
Get phone name like [[UIDevice currentdevice] name] in js or php
在objective-c中,您可以使用[[UIDevice currentDevice] name]
获取电话名称(例如My iPhone 5)。
我花了两天的时间试图弄清楚是否可以从js或php获得它,但只看到了对操作系统版本或设备型号的引用。
您可以通过php:解析http用户代理字符串
if(strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
echo "You're using iPhone.";
}
if(strstr($_SERVER['HTTP_USER_AGENT'], 'iPod')) {
echo "You're using iPod.";
}
if(strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) {
echo "You're using iPad.";
}
if(strstr(strtolower($_SERVER['HTTP_USER_AGENT']), 'android')) {
echo "You're using Android device.";
}
在David Walsh的博客上找到更多信息:1,2,3。