1. 云栖社区>
  2. PHP教程>
  3. 正文

PHP 调用Java Dubbo服务(Dubbo、Hessian、JsonRPC)

作者:用户 来源:互联网 时间:2017-11-30 17:09:04

javaphpdubbo服务调用hessianjsonRPC

PHP 调用Java Dubbo服务(Dubbo、Hessian、JsonRPC) - 摘要: 本文讲的是PHP 调用Java Dubbo服务(Dubbo、Hessian、JsonRPC), Composer: Key Value 包名 lornewang/idiot 安装 composer require lornewang/idiot Composer https://packagist.org/

Composer:

Key Value
包名 lornewang/idiot
安装 composer require lornewang/idiot
Composer https://packagist.org/packages/lornewang/idiot
Github https://github.com/lornewang/idiot

因 composer 没有稳定版本,安装失败。

一、安装 lornewang/idiot 包依赖

查看 lornewang/idiot 依赖

{  "name": "lornewang/idiot",  "description": "PHP Dubbo Client in Zookeeper",  "keywords": ["dubbo", "zookeeper"],  "type": "library",  "license": "MIT",  "require": {    "php": ">=5.4",    "icecave/flax": "0.1.*"  },  "autoload": {    "psr-4": {      "Idiot//": "src"     }  }}

安装 icecave/flax

composer require icecave/flax

二、安装 lornewang/idiot

安装 lornewang/idiot

mkdir vendor/lornewangcd vendor/lornewang/git clone https://github.com/lornewang/idiot.git

三、修改composer配置

"autoload":{    "psr-4" : {        "Idiot//":"packages/lornewang/idiot/src/"                                        }}

更新 composer

composer dump-autoload

四、测试

include './vendor/autoload.php';use Idiot/Service;use Idiot/Type;$options = [    "conn" => "10.60.0.63:2181",    "path" => "com.noriental.encouragesvr.score.service.ScoreConfigService",    "version" => "1.0.0"];$service = new Service($options);$data = $service->invoke('getOneResourceMaxScore',[]);                                   print_r( $data );

以上是云栖社区小编为您精心准备的的内容,在云栖社区的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索java , php , dubbo , 服务 , 调用 , hessian jsonRPC ,以便于您获取更多的相关知识。