2

标头Accept-CH不显示,无法用于php判断win11

 2 years ago
source link: https://www.oschina.net/question/5597372_2324956
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

标头Accept-CH不显示,无法用于php判断win11

osc_46761569 发布于 昨天 17:32

为了判断win10和win11系统,我根据教程在head中间加入了

<meta http-equiv="Accept-CH" content="Sec-CH-UA-Platform-Version">

希望能够让页面获取系统型号。然而php文件都不显示这个header,结果中没有型号,也找不到Accept-CH
反而是图片、js、css文件的header全都带有这个结果。。Win10会显示10.0.0,Win11会显示14.0.0

现在需要将这个结果用在PHP里面判断

	if(is_browser_request()){	

		$user_agent = $_SERVER['HTTP_USER_AGENT'];
		$systemid = ___________________;
		
		if (stripos($user_agent, "iPhone")!==false) {
			$brand = 'iPhone';
		} else if (stripos($systemid, "10.0.0")!==false) {
			$brand = 'Win10';
		} else if (stripos($systemid, "14.0.0")!==false) {
			$brand = 'Win11';
		} else if (stripos($user_agent, "Windows NT 6.1")!==false) {
			$brand = 'Win7';
		} else {
			$brand = '其他系统';
		}

请问如何让php文件显示这个header呢?以及如何定义,是否应该是

$systemid = $_SERVER['HTTP_SEC_CH_UA_PLATFORM_VERSION'];


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK