2013-12-08 38 views
0

在objective-c中,您可以使用[[UIDevice currentDevice] name]獲取手機名稱(例如我的iPhone 5)。獲取手機名稱,如js或php中的[[UIDevice currentdevice] name]

我試圖找出兩天,如果它是可以從js或php得到它,但只看到操作系統版本或設備模型的引用。

+0

做的瀏覽器,你可以這樣做: http://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-handheld-device-in -jquery – samfr

回答

0

您可以通過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."; 
} 

查找更多關於大衛·沃爾什的博客:123

+0

我知道這一點。我試圖找出如何獲得手機的名稱,如'安迪的iPhone' –

相關問題