首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用amfphp时出现错误

使用amfphp时出现错误
EN

Stack Overflow用户
提问于 2017-10-29 21:25:10
回答 1查看 74关注 0票数 0

我该如何解决这个问题?错误是: Fatal error: Using $this when not in object context in /.../amfphp/core/amf/app/Gateway.php on line 134

代码语言:javascript
复制
public static function service() {

        //Set the parameters for the charset handler
        CharsetHandler::setMethod($this->_charsetMethod); // the problem points 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('?');

        $GLOBALS['amfphp']['actions'] = $this->actions;
EN

回答 1

Stack Overflow用户

发布于 2017-10-29 21:48:26

不能在static方法中使用$this变量,因为类实例不存在。静态方法对类的实例一无所知,您可以将这些方法视为class methods,而不是instance methods。看起来你需要删除这个函数的static修饰符。有关详细说明,请查看docs

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47000696

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档