";损坏的成员变量名称“;在PHP中尝试访问静态函数


"Corrupt member variable name" in PHP trying to access to a static function

"损坏的成员变量名"异常是试图访问静态函数时抛出的:

class CachedSettings
{
    static private $c;
    static private function getCacheInstance() 
    {
        if(!isset(self::$c)) self::$c = phpFastCache();
        return self::$c;
    }
    static public function getGroup($groupName) 
    {
        $cache = CachedSettings::getCacheInstance();
        ...

我试过self::,结果是一样的。看起来这不是一个很常见的错误。知道吗?

所以,我没有发现任何错误,但您可能想检查一下您的PHP版本。他们最近发布了5.6.x。如果您的本地主机与服务器或其他版本不同,这可能就是问题所在。

  1. 安装PHP 5.6.X:curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
  2. 编辑~/.bash_profile:open -a TextEdit ~/.bash_profile
  3. 在.bash_profile底部添加路径:export PATH=/usr/local/php5/bin:$PATH
  4. 使bash_profile最终确定:source ~/.bash_profile
  5. 仔细检查PHP 5.6.X是否正常工作:php -v

如果您在升级时需要更多帮助

希望这有帮助,