mtoolkit/mtoolkit-network
Composer 安装命令:
composer require mtoolkit/mtoolkit-network
包简介
The network module of MToolkit framework
README 文档
README
The network module of MToolkit framework.
RPC-JSON
JSON-RPC is a remote procedure call protocol encoded in JSON
Server
Create a RPC-JSON server is simple. This example implements an web service to sum 2 number:
class RPCJsonWebService extends MRPCJsonWebService { public function __construct(){} public function sum($data) { $response = new MRPCJsonResponse(); $response->setId( $this->getRequest()->getId() ); $response->setResult( array( 'sum' => $data['a'] + $data['b'] ) ); $this->setResponse( $response ); } }
Client
This is the client of the above example:
$request = new MRPCJsonRequest(); $request->setId(1) ->setMethod('sum') ->setParams( array('a'=>1, 'b'=>2) ); $client = new MRPCJsonClient($url); $client->call($request); $response = $client->getResponse();
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0
- 更新时间: 2016-01-18