doulezhi5326 2017-10-29 17:41
浏览 102

我执行amfphp文件时出错

I have one page in my site with flash, but I have a problem. When I try to execute dircetly the file site.com/amfphp/gateway.php I get this error:

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('?');

How can I fix this?

  • 写回答

1条回答 默认 最新

  • dousong9729 2018-03-06 14:20
    关注

    Apparently the setMethod function of the CharsetHandler class isn't static. That means you can't call it unless you have an instance of that class. Alexander's suggestion to call setMethod on each of the two instances is appropriate. Your code should read:

    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('?');
    

    This should work if the other two methods you call staticaly are indeed static.

    评论

报告相同问题?

悬赏问题

  • ¥15 制裁名单20240508芯片厂商
  • ¥20 易康econgnition精度验证
  • ¥15 线程问题判断多次进入
  • ¥15 msix packaging tool打包问题
  • ¥28 微信小程序开发页面布局没问题,真机调试的时候页面布局就乱了
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接