无法访问__callStatic内的Super Globals?

Xeo*_*oss 4 php static-methods

以下代码在我的安装上失败,PHP 5.3.6-13ubuntu3.2这让我想知道为什么我无法在此方法中访问$ _SERVER Super Global.

<?php

header('Content-Type: text/plain');

$method = '_SERVER';
var_dump($$method); // Works fine

class i
{
    public static function __callStatic($method, $args)
    {
        $method = '_SERVER';
        var_dump($$method); // Notice: Undefined variable: _SERVER
    }
}

i::method();
Run Code Online (Sandbox Code Playgroud)

谁知道这里有什么问题?

Chr*_*ker 8

如手册中所示:

Note: Variable variables

Superglobals cannot be used as variable variables inside functions or class methods. 
Run Code Online (Sandbox Code Playgroud)

(参考)

  • 它就是.伙计,我每天都学到新东西.:) 做得好.+1 (2认同)