The first thing to note is that PHP is the server-side language and is not getting the width and height of the client's screen. However, the workaround is to get the client's computer screen width and height through the client-side scripting language JavaScript, and then pass it to the PHP scripting language in the form of Ajax or cookies, thus enabling PHP to get the width and height of the client computer screen.
The method of obtaining the width, height, and resolution of the client computer via JavaScript is as follows:
High screen resolution: Window.screen.height
Width of screen resolution: Window.screen.width
Screen available work area height: window.screen.availHeight
Screen available work area width: window.screen.availWidth
The methods passed to the PHP server are as follows:
$.post (' http://www.onesheng.cn/php-template-framework/189.html ', {w:width,h:height});//The return value is omitted here
The complete code for the width, height, and resolution of the display screen of the client computer via PHP is as follows:
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Untitled Document </title>
<script type= "Text/javascript" src= "Http://www.onesheng.cn/js/jquery.min.js" ></script>
<script type= "Text/javascript" >
$ (function () {
var width=window.screen.height;
var height=window.screen.width;
$.post (' http://www.onesheng.cn/php-template-framework/189.html ', {w:width,h:height});//Here the relevant parameters are passed to your statistics file
});
</script>
<body>
Here is the text ...
</body>
Use PHP to get mobile phone information