【发布时间】: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