Home > Backend Development > PHP Tutorial > How to get the client computer screen parameters in php, get the screen parameters_PHP tutorial

How to get the client computer screen parameters in php, get the screen parameters_PHP tutorial

WBOY
Release: 2016-07-13 10:09:55
Original
995 people have browsed it

How to get the screen parameters of the client computer in php, get the screen parameters

The example in this article describes the method of obtaining the screen parameters of the client computer in PHP. Share it with everyone for your reference. The specific analysis is as follows:

First of all, it needs to be explained that php is a server-side language and cannot obtain the width and height of the client's screen. However, a workaround is to obtain the width and height of the client's computer screen through the client script language JavaScript, and then pass it to the PHP script language in the form of ajax or cookie, so that PHP can obtain the width and height of the client's computer screen.

The method of obtaining the width, height, and resolution of the client computer through javascript is as follows:

High screen resolution: window.screen.height

Width of screen resolution: window.screen.width

Screen available workspace height: window.screen.availHeight

Screen available workspace width: window.screen.availWidth

The method passed to the php server is as follows:

Copy code The code is as follows:
$.post('http://localhost/php/index.php',{w:width,h :height});//The return value is ignored here

Based on the above, the complete code to obtain the width, height and resolution of the client computer display screen through php is as follows:

Copy code The code is as follows:



Untitled Document




Here is the text...

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/940495.htmlTechArticleHow to get the screen parameters of the client computer in php. Get the screen parameters. This article explains how to get the screen parameters of the client computer in php. method. Share it with everyone for your reference. Specific analysis is as follows...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template