gpt4 book ai didi

php - $_SERVER ['HTTP_REFERER' ] 与 Request.ServerVariables ("HTTP_REFERER")

转载 作者:搜寻专家 更新时间:2023-10-31 21:46:20 25 4
gpt4 key购买 nike

如果查询字符串包含非英文字符,为什么 $_SERVER['HTTP_REFERER'] (PHP) 和 Request.ServerVariables("HTTP_REFERER") (ASP) 返回不同的结果?

php 返回正确的值但 asp 不会:

php: сабака

asp: ׁ׀°׀±׀°׀÷׀°

最佳答案

根据 RFC 2616 , 不在 ISO-8859-1 中的字符应进行特殊编码。因此,无论是谁向您发送 header ,似乎都违反了规范。请参阅field-contentTEXT

4.2 Message Headers

message-header = field-name ":" [ field-value ]
field-name = token
field-value = *( field-content | LWS )
field-content = <the OCTETs making up the field-value
and consisting of either *TEXT or combinations
of token, separators, and quoted-string>

2.2 Basic Rules

TEXT           = <any OCTET except CTLs,
but including LWS>

The TEXT rule is only used for descriptive field contents and values that are not intended to be interpreted by the message parser. Words of *TEXT MAY contain characters from character sets other than ISO- 8859-1 [22] only when encoded according to the rules of RFC 2047 [14].

关于php - $_SERVER ['HTTP_REFERER' ] 与 Request.ServerVariables ("HTTP_REFERER"),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2942958/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com