What does this mean? “Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM”

前端 未结 8 1660
囚心锁ツ
囚心锁ツ 2020-11-28 09:34

T_PAAMAYIM_NEKUDOTAYIM sounds really exotic, but most certainly absolutely nonsense to me. I traced it all down to this lines of code:



        
8条回答
  •  渐次进展
    2020-11-28 10:06

    The error is down to an "inappropriate use" of the double colon operator:

    return $cnf::getConfig($key);
    

    as by using the :: you're attempting to call a static method of the class itself. In your example you want to call a non-static method on an instantiated object.

    I think what you want is:

    return $cnf->getConfig($key);
    

提交回复
热议问题