Home php教程 php手册 php获取客户端电脑屏幕参数的方法

php获取客户端电脑屏幕参数的方法

Jun 06, 2016 pm 08:14 PM
php parameter client Screen method computer Obtain

这篇文章主要介绍了php获取客户端电脑屏幕参数的方法,可获得宽度,高度,分辨率等参数,主要使用了js的方法获取客户端电脑屏幕的参数再利用Ajax返回给服务器端,进而

本文实例讲述了php获取客户端电脑屏幕参数的方法。分享给大家供大家参考。具体分析如下:

首先需要说明的是php是服务器端的语言,是获取不到客户端的屏幕的宽度和高度的。但是有变通的方法就是通过客户端脚本语言javascript获取客户端的电脑屏幕的宽度和高度,然后通过ajax或者cookie的形式传递给php脚本语言,从而实现php获取客户端电脑屏幕宽度和高度的办法。

通过javascript获取客户端电脑的宽度,,高度,分辨率的方法如下:

屏幕分辨率的高: window.screen.height

屏幕分辨率的宽: window.screen.width

屏幕可用工作区高度: window.screen.availHeight

屏幕可用工作区宽度: window.screen.availWidth

传递给php服务器端的方法如下:

复制代码 代码如下:

$.post('http://localhost/php/index.php',{w:width,h:height});//这里忽略了返回值

综合以上通过php获取客户端电脑显示屏幕的宽度,高度,分辨率的完整代码如下:

复制代码 代码如下:




无标题文档




这里是正文......

希望本文所述对大家的php程序设计有所帮助。

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Pi Node Teaching: What is a Pi Node? How to install and set up Pi Node? Mar 05, 2025 pm 05:57 PM

Detailed explanation and installation guide for PiNetwork nodes This article will introduce the PiNetwork ecosystem in detail - Pi nodes, a key role in the PiNetwork ecosystem, and provide complete steps for installation and configuration. After the launch of the PiNetwork blockchain test network, Pi nodes have become an important part of many pioneers actively participating in the testing, preparing for the upcoming main network release. If you don’t know PiNetwork yet, please refer to what is Picoin? What is the price for listing? Pi usage, mining and security analysis. What is PiNetwork? The PiNetwork project started in 2019 and owns its exclusive cryptocurrency Pi Coin. The project aims to create a one that everyone can participate

How to adjust Sesame Open Exchange into Chinese How to adjust Sesame Open Exchange into Chinese Mar 04, 2025 pm 11:51 PM

How to adjust Sesame Open Exchange to Chinese? This tutorial covers detailed steps on computers and Android mobile phones, from preliminary preparation to operational processes, and then to solving common problems, helping you easily switch the Sesame Open Exchange interface to Chinese and quickly get started with the trading platform.

Sesame Open Door Exchange Web Page Login Latest version gateio official website entrance Sesame Open Door Exchange Web Page Login Latest version gateio official website entrance Mar 04, 2025 pm 11:48 PM

A detailed introduction to the login operation of the Sesame Open Exchange web version, including login steps and password recovery process. It also provides solutions to common problems such as login failure, unable to open the page, and unable to receive verification codes to help you log in to the platform smoothly.

Ouyi official website link Ouyi okx official website entrance link Ouyi official website link Ouyi okx official website entrance link Mar 04, 2025 pm 11:42 PM

Ouyi’s official website provides a safe and reliable digital asset trading platform, and users can obtain real and valid official website addresses and entrance links through official channels. To ensure the security of funds and transaction compliance, please be cautious in distinguishing between official websites and false links, and go to the official website to confirm the latest information. The Ouyi platform is subject to a number of international certifications and license supervision, and is committed to creating a safe and transparent trading environment for users.

Ouyi Exchange app domestic download tutorial Ouyi Exchange app domestic download tutorial Mar 21, 2025 pm 05:42 PM

This article provides a detailed guide to safe download of Ouyi OKX App in China. Due to restrictions on domestic app stores, users are advised to download the App through the official website of Ouyi OKX, or use the QR code provided by the official website to scan and download. During the download process, be sure to verify the official website address, check the application permissions, perform a security scan after installation, and enable two-factor verification. During use, please abide by local laws and regulations, use a safe network environment, protect account security, be vigilant against fraud, and invest rationally. This article is for reference only and does not constitute investment advice. Digital asset transactions are at your own risk.

Binance Exchange app domestic download tutorial Binance Exchange app domestic download tutorial Mar 21, 2025 pm 05:45 PM

This article provides a safe and reliable Binance Exchange App download guide to help users solve the problem of downloading Binance App in the country. Due to restrictions on domestic application stores, the article recommends priority to downloading APK installation packages from Binance official website, and introduces three methods: official website download, third-party application store download, and friends sharing. At the same time, it emphasizes security precautions during the download process, such as verifying the official website address, checking application permissions, scanning with security software, etc. In addition, the article also reminds users to understand local laws and regulations, pay attention to network security, protect personal information, beware of fraud, rational investment, and secure transactions. At the end of the article, the article once again emphasized that downloading and using Binance App must comply with local laws and regulations, and at your own risk, and does not constitute any investment advice.

What is Binance opBNB? What are the impacts on users? What is Binance opBNB? What are the impacts on users? Mar 05, 2025 pm 12:36 PM

Binance launches opBNB: Binance recently announced the launch of a new expansion solution for BNB Smart Chain (BSC) - opBNB Test Network. This article will explain the characteristics of opBNB and its potential impact on users. opBNB Detailed explanation opBNB is a Layer2 extension solution built on OptimismOPStack, compatible with Ethereum Virtual Machine (EVM). It aims to improve the scalability of BSC, alleviate network congestion, and reduce transaction costs. In order to better understand opBNB, we need to understand the following key concepts: Layer2 (Blockchain Layer 2): transfer some main chain functions to the second layer, thereby improving the main

How to download gateio mobile Android version How to download Gate.io mobile Android version How to download Gate.io mobile Android version How to download gateio mobile Android version How to download Gate.io mobile Android version How to download Gate.io mobile Android version Mar 04, 2025 pm 09:57 PM

The steps for downloading Gate.io Android mobile version are as follows: 1. Visit the official Gate.io website and download the APK file. 2. Enable installation options from unknown sources in the device. 3. Install the APK file and follow the prompts. 4. Complete the installation and start the application.

See all articles