Php is a server-side programming language. how can we use php to obtain the client computer screen parameters (width, height, resolution? The method is simple, that is, ajax. the first thing to note is that php is a server-side language and cannot obtain the width and... php is a server-side programming language. how can we use php to obtain the client computer screen parameters (width, height, resolution? The method is simple, that is, ajax.
The first thing to note is that php is a server-side language and cannot obtain the width and height of the client screen, however, the work und is to use the client scripting language javascript to obtain the width and height of the client's computer screen, and then pass it to the php scripting language in the form of ajax or cookie, in this way, php can obtain the screen width and height of the client computer.
You can use javascript to obtain the width, height, and resolution of the client.
Screen resolution height: window. screen. height
Screen resolution width: window. screen. width
Available screen workspace height: window. screen. availHeight
Available workspace width: window. screen. availWidth
The method passed to the php server is as follows:
$. Post ('http: // www.baidu.com/php-template-framework/189.html', expires w:width,h:height}); // the returned value is ignored here
The complete code for obtaining the width, height, and resolution of the display screen on the client computer using php is as follows:
Untitled Document