温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

phprpc远程调用报错,不知道什么原因

发布时间:2020-06-10 15:47:48 来源:网络 阅读:744 作者:mhxj1000 栏目:web开发

我在学习phprpc远程调用,按照网上的教程,发现报错:Incorrect response id (request id: 1, response id: ) n;好纠结啊,求教。贴出代码如下: 
服务端,member.php 
<?php 
require_once 'jsonRPCServer.php'; 
/** 
User: Administrator 
Date: 2015/12/28 

Time: 11:06 
*/ 
class member 

public function getName() 
{        return 'hello word '; // 返回字符串} 


// 服务端调用 
$myExample = new member(); 
// 注入实例 
jsonRPCServer::handle($myExample) or print 'no request'; 
客户端:client.php 
<?php 
/** 
User: Administrator 
Date: 2015/12/28 
Time: 11:07*/require_once 'jsonRPCClient.php';//$url = 'http://localhost/phprpc/server.php';$url = 'http://localhost/phprpc/member.php';$myExample = new jsonRPCClient($url);echo '';print_r($myExample);// 客户端调用 

try 

$name = $myExample->getName(); 
echo $name; 
} catch (Exception $e) 

echo nl2br($e->getMessage()) . ' 
' . "n"; 
}

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI