时间:2021-07-01 10:21:17 帮助过:15人阅读
点击上面的链接去官网下载的php版本,把压缩包解压到网站根目录(我的是phprpc)。在根目录下创建两个测试文件server.php与client.php。
server.php代码:
add('HelloWorld');
$server->start();
function HelloWorld() {
return 'Hello World!';
}?>
client.php代码:
HelloWorld();
?>
用浏览器访问http://127.0.0.1/client.php,正常输出 "Hello World!"。如果类似下图的错误,
解决方法:打开phprpc\compat.php,在第72行(可能有差异)找到function gzdecode($data, &$filename = '', &$error = '', $maxlength = null) ,把这个函数用下面的代码包括起来即可。
if (! function_exists('gzdecode')) {
//将gzdecode函数包括进来
}
以上就介绍了PHPRPC的简单使用,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。