相关疑难解决方法(0)

无法访问__callStatic内的Super Globals?

以下代码在我的安装上失败,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)

谁知道这里有什么问题?

php static-methods

4
推荐指数
1
解决办法
360
查看次数

标签 统计

php ×1

static-methods ×1