从数组构建查询字符串时,点被下划线替换

Dot replaced by underscore while building query string from array

我想知道为什么在这个操作过程中点被下划线代替:

$s = http_build_query([
    "!~.var" => "",
]);

$a = parse_str($s, $r);

echo $s;

print_r($r);

打印:

%21%7E.var=

Array
(
    [!~_var] => 
)

parse_str() — 将字符串解析为变量

Variables 名字中不允许有点。

$hello.world = 'hello world'; <-- 是非法的。

$hello_world = 'hello world'; <-- 合法