【问题标题】:Zend Framework 2 JSON-RPC Invalid RequestZend Framework 2 JSON-RPC 无效请求
【发布时间】:2013-12-08 12:50:49
【问题描述】:

我在尝试使用官方documintation 在 Zend Framework 2 下实现 JSON-RPC 服务器时遇到了一些问题

我在 application/model/calculator.php 下创建了计算器类 但在 application/controller/indexController.php 中,我无法成功处理服务器请求:

public function indexAction(){
  $server = new \Zend\Json\Server\Server();
  // Indicate what functionality is available:
  $server->setClass('Application\Model\Calculator');
  // Handle the request:
  $server->handle();
  $view = new ViewModel();
  return $view;
}

并得到以下错误:

{"error":{"code":-32600,"message":"Invalid Request","data":null},"id":null}

不用说,我在网上没有找到任何关于实现 JSON-RPC 到 zend framework2 的好教程。

【问题讨论】:

    标签: php zend-framework2 json-rpc


    【解决方案1】:

    我为此使用了 zf1,并考虑使用 zf2。

    唯一的建议是检查请求,也许你没有使用命名参数。 无论如何,只需调试 zf2 源代码即可。

    【讨论】:

      猜你喜欢
      • 2015-12-20
      • 1970-01-01
      • 1970-01-01
      • 2012-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多