ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

php-$_SERVER [‘HTTP_USER_AGENT’]可以包含”符号吗?

2019-11-20 06:30:20  阅读:267  来源: 互联网

标签:user-agent php


我想知道$_SERVER [‘HTTP_USER_AGENT’]是否可以用而不是空格输出用户代理.我看到我的网站的投票系统正在使用用户代理中的加号进行很多投票,例如:

Mozilla/5.0+(Windows+NT+6.2;+WOW64;+rv:33.0)+Gecko/20100101+Firefox/33.0
Mozilla/5.0+(Windows+NT+5.1;+U;+en)+Presto/2.10+Version/11.60

我怀疑这是欺骗用户代理的某种作弊软件,但是做错了.这是真的吗,或者用户代理真的可以这样吗?

解决方法:

您已经看到用户代理标头看起来像这样,因为它们看起来像这样. ;)但是,真正的Mozilla浏览器不会将替换为.您可以确定这不是Mozilla浏览器.

但是HTTP standard怎么说呢?

The User-Agent request-header field contains information about the user agent originating the request. This is for statistical purposes, the tracing of protocol violations, and automated recognition of user agents for the sake of tailoring responses to avoid particular user agent limitations. User agents SHOULD include this field with requests. The field can contain multiple product tokens (section 3.8) and comments identifying the agent and any subproducts which form a significant part of the user agent. By convention, the product tokens are listed in order of their significance for identifying the application.

让我们看一下第3.8节

Product tokens are used to allow communicating applications to identify themselves by software name and version. Most fields using product tokens also allow sub-products which form a significant part of the application to be listed, separated by white space. By convention, the products are listed in order of their significance for identifying the application.

首先,该标准将其定义为应由客户端发送,这意味着完全没有必要.另一方面,第3.8节建议使用空格来分隔各个要素.但是没有真正标准化的东西.版本号可能看起来像CoolBrowser2.也允许评论.

标签:user-agent,php
来源: https://codeday.me/bug/20191120/2041945.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有