2017-10-29 14 views
1

私のサイトにはフラッシュが1ページありますが、問題があります。 私はdircetlyファイルsite.com/amfphp/gateway.phpを実行しようとすると、私はこのエラーを取得: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

私はそれを呼び出すでしょうが、どのパラメータを置くべきですか? '$ ch = new ChasetHandler( 'HERE');' –

答えて

0

明らかに、CharsetHandlerクラスのsetMethod関数は静的ではありません。つまり、そのクラスのインスタンスを持っていなければ呼び出すことはできません。 2つのインスタンスのそれぞれに対して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('?'); 

統計的に呼んでいる他の2つの方法が実際に静的である場合には、これが有効です。

関連する問題