Use PHP to get mobile phone information

Source: Internet
Author: User
Tags php server

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.