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

来源:互联网 发布:linux tomcat 日志查看 编辑:程序博客网 时间:2024/05/29 16:59

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 );
原创粉丝点击