我该如何解决这个问题?错误是: Fatal error: Using $this when not in object context in /.../amfphp/core/amf/app/Gateway.php on line 134
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;发布于 2017-10-29 21:48:26
不能在static方法中使用$this变量,因为类实例不存在。静态方法对类的实例一无所知,您可以将这些方法视为class methods,而不是instance methods。看起来你需要删除这个函数的static修饰符。有关详细说明,请查看docs。
https://stackoverflow.com/questions/47000696
复制相似问题