2017-10-29 11 views
1

내 사이트에 플래시가있는 페이지가 하나 있지만 문제가 있습니다. 내가이 오류를 얻을 site.com/amfphp/gateway.php dircetly 파일을 실행하려고 할 때 : amfphp 파일을 실행할 때 오류가 발생합니다.

Fatal error: Uncaught exception 'VerboseException' with message 'Non-static method CharsetHandler::setMethod() should not be called statically, assuming $this from incompatible context' in ....

function service() { 

//Set the parameters for the charset handler 
CharsetHandler::setMethod($this->_charsetMethod); // the problem point here 
CharsetHandler::setPhpCharset($this->_charsetPhp); 
CharsetHandler::setSqlCharset($this->_charsetSql); 

//Attempt to call charset handler to catch any uninstalled extensions 
$ch = new CharsetHandler('flashtophp'); 
$ch->transliterate('?'); 

$ch2 = new CharsetHandler('sqltophp'); 
$ch2->transliterate('?'); 

가 어떻게이 문제를 해결할 수 있습니까?

+0

각 개체의 메서드를 대신 호출 해보십시오. '$ ch-> setMethod ($ this -> _ charsetMethod);' –

+0

나는 그것을 부를 것이지만, 어떤 매개 변수를 넣어야 할까? 012ch'$ ch = new ChasetHandler ('HERE'); –

답변

0

분명히 CharsetHandler 클래스의 setMethod 함수는 정적이 아닙니다. 즉, 해당 클래스의 인스턴스가 없으면 호출 할 수 없습니다. 두 인스턴스 각각에 대해 setMethod를 호출하는 Alexander의 제안이 적절합니다. 코드는 다음과 같아야합니다.

function service() { 

    //Set the parameters for the charset handler 
    CharsetHandler::setPhpCharset($this->_charsetPhp); 
    CharsetHandler::setSqlCharset($this->_charsetSql); 

    //Attempt to call charset handler to catch any uninstalled extensions 
    $ch = new CharsetHandler('flashtophp'); 
    $ch->setMethod($this->_charsetMethod); 
    $ch->transliterate('?'); 

    $ch2 = new CharsetHandler('sqltophp'); 
    $ch2->setMethod($this->_charsetMethod); 
    $ch2->transliterate('?'); 

통계적으로 호출하는 다른 두 가지 방법이 실제로 정적 인 경우이 방법이 작동합니다.