php获取屏幕的宽度和高度

如果前台没有传输当前请求的宽度和高度,我们有时候需要用php借助javascript获取屏幕的宽和高,以控制现实的样式,代码如下:


if (isset($_GET['width']) AND isset($_GET['height'])) {
    // output the geometry variables
    echo "Screen width is: " . $_GET['width'] . "
\n"
; echo "Screen height is: " . $_GET['height'] . "
\n"
; } else { // pass the geometry variables // (preserve the original query string // -- post variables will need to handled differently) echo "\n"; exit(); }

php获取屏幕的宽度和高度_第1张图片

你可能感兴趣的:(php)