2012-06-13 107 views

回答

3

您必須考慮到您試圖在服務器端獲取客戶端信息的事實。

您似乎無法使用純PHP或Zend框架檢測顯示。

它進一步看起來像來自客戶端的UserAgent信息,您可能從PHP訪問基於操作系統,而不是硬件,因此不會幫助您。

您可能有興趣閱讀以下更有說服力和更徹底地解釋問題的文章。

http://www.bdoran.co.uk/2010/07/19/detecting-the-iphone4-and-resolution-with-javascript-or-php/

祝你好運!

+0

感謝,it'ss爲我的iPhone應用程序不夠好。 –

1

我認爲顯示器寬度檢測對於這樣的任務來說足夠簡單,視網膜顯示器會在寬度上包裝這麼多像素,簡單的檢查會立即告訴您它是普通顯示器還是視網膜顯示器。 PHP並不具備這種功能,但Javascript確實如此。

方法如下:

<script language="Javascript">  
<!--  
document.write('<br>your resolution is' + screen.width + 'x' + screen.height)  
//-->  
</script> 
2

的Javascript:window.devicePixelRatio

4

我搞清楚這個

var retina = window.devicePixelRatio > 1; 

if (retina) 
{ 
    // the user has a retina display 
} 
else 
{ 
    // the user has a non-retina display 
}