Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
执行amfphp文件时出错_Php_Flash_Amfphp - Fatal编程技术网

执行amfphp文件时出错

执行amfphp文件时出错,php,flash,amfphp,Php,Flash,Amfphp,我有一个网页在我的网站与flash,但我有一个问题。 当我试图直接执行文件site.com/amfphp/gateway.php时,我得到以下错误: 致命错误:未捕获的异常“VerboseException”包含消息 '不应调用非静态方法CharsetHandler::setMethod() 静态地,假设$this来自不兼容的上下文“in…” 我怎样才能解决这个问题 显然CharsetHandler类的setMethod函数不是静态的。这意味着您不能调用它,除非您有该类的实例。Alexander

我有一个网页在我的网站与flash,但我有一个问题。 当我试图直接执行文件site.com/amfphp/gateway.php时,我得到以下错误:

致命错误:未捕获的异常“VerboseException”包含消息 '不应调用非静态方法CharsetHandler::setMethod() 静态地,假设$this来自不兼容的上下文“in…”


我怎样才能解决这个问题

显然CharsetHandler类的setMethod函数不是静态的。这意味着您不能调用它,除非您有该类的实例。Alexander建议对这两个实例中的每一个调用setMethod是合适的。您的代码应为:

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

如果您调用staticaly的其他两个方法确实是静态的,那么这应该可以工作。

显然CharsetHandler类的setMethod函数不是静态的。这意味着您不能调用它,除非您有该类的实例。Alexander建议对这两个实例中的每一个调用setMethod是合适的。您的代码应为:

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

如果您静态调用的其他两个方法确实是静态的,那么这应该是可行的。

是否可以尝试在每个对象上调用该方法<代码>$ch->setMethod($this->\u charsetMethod)我将调用它,但是我应该设置哪些参数
$ch=newchasethandler('HERE')是否可以尝试对每个对象调用该方法<代码>$ch->setMethod($this->\u charsetMethod)我将调用它,但是我应该设置哪些参数
$ch=newchasethandler('HERE')