0

当我从 flash 调用端点时,所有操作都做得很好,但响应为空。代码是:

class AmfController extends Zend_Controller_Action {
    public function indexAction()
    {
        $server = new Zend_Amf_Server();
        $server->setProduction(false);
        $server->setClass('Application_Model_Amf');
        $response = $server->handle();
        echo $response;
    }
}

class Application_Model_Amf {
    /**
     *
     * @param bytearray $data
     * @param string $dateString
     * @return int
     */
    public function save($data, $dateString)
    {
        $dateString = str_replace(array('|', ':'), array('_', ''), $dateString);
        //file_put_contents("$dateString.jpg", $data);
        $r = new stdClass();
        $r->error = 0;
        return $r;
    }
}

我也试过

    public function save($data, $dateString)
    {
        $dateString = str_replace(array('|', ':'), array('_', ''), $dateString);
        //file_put_contents("$dateString.jpg", $data);
        return true;
    }

但它既不工作 - 仍然是空的反应。我怎样才能返回这样的 stdClass() 响应?还是只有整数值 1 或 0?

4

1 回答 1

0

解决方案是添加die()

public function indexAction()
{
    $server = new Zend_Amf_Server();
    $server->setProduction(false);
    $server->setClass('Application_Model_Amf');
    $response = $server->handle();
    echo $response;
    die();
}
于 2012-07-01T23:59:01.850 回答