Getting the screen resolution using PHP

前端 未结 21 1878
你的背包
你的背包 2020-11-22 06:50

I need to find the screen resolution of a users screen who visits my website?

21条回答
  •  渐次进展
    2020-11-22 07:14

    This is a very simple process. Yes, you cannot get the width and height in PHP. It is true that JQuery can provide the screen's width and height. First go to https://github.com/carhartl/jquery-cookie and get jquery.cookie.js. Here is example using php to get the screen width and height:

        
        
        
            
            Test
            
            
            
            
        
        
            

    Using jquery.cookie.js to store screen height and width

    ";} if(isset($_COOKIE['sh'])) { echo "Screen height: ".$_COOKIE['sh']."
    ";} ?>

    I have a test that you can execute: http://rw-wrd.net/test.php

提交回复
热议问题