PHPではUAが送ってくるHTTPヘッダは
$_SERVERという連想配列に格納されている。
で,この任意のヘッダを取ってくるにはどうしたらよいか。
例えば俺のIEはUA-CPUというユーザー定義のヘッダを吐くが,
これはCGIの仕様で定められる値について
PHPで文字列をキーとすると値が取得できる
http://hoohoo.ncsa.uiuc.edu/cgi/env.html
>In addition to these, the header lines received from the client, if any, are placed into the environment with the prefix HTTP_ followed by the header name. Any - characters in the header name are changed to _ characters.
HTTP_UA_CPU
じゃあ,
UA-CPUとUA_CPUという二つのヘッダがあったらどうすんだ?
http://www.studyinghttp.net/header#Extension-Header
によれば,ヘッダは独自に作成でき,これはRFC822の形式に従うようだ。
field = field-name ":" [ field-body ] CRLF
field-name = 1*<any CHAR, excluding CTLs, SPACE, and ":">
CHAR = <any ASCII character> ; ( 0-177, 0.-127.)
CTL = <any ASCII control ; ( 0- 37, 0.- 31.)
; ( 177, 127.)
SPACE = <ASCII SP, space> ; ( 40, 32.)
つーことで,
http://www.fileformat.info/info/unicode/char/005f/index.htm
U+005F→95
http://www.cs.tut.fi/~jkorpela/dashes.html
U+002D→45
だから多分両方有効。