phprpc 是一个轻型的、安全的、跨网际的、跨语言的、跨平台的、跨环境的、跨域的、支持复杂对象传输的、支持引用参数传递的、支持内容输出重定向的、支持分级错误处理的、支持会话的、面向服务的高性能远程过程调用协议。了解更多请访问 http://www.phprpc.com。
点击上面的链接去官网下载的php版本,把压缩包解压到网站根目录(我的是phprpc)。在根目录下创建两个测试文件server.php与client.php。
server.php代码:
<?php
include ("php/phprpc_server.php");
$server = new PHPRPC_Server();
$server->add('HelloWorld');
$server->start();
<pre name="code" class="php"> function HelloWorld() {
return 'Hello World!';
}client.php代码:
<?php
include ("php/phprpc_client.php");
$client = new PHPRPC_Client('http://localhost/server.php');
echo $client->HelloWorld();
?>
解决方法:打开phprpc\compat.php,在第72行(可能有差异)找到function gzdecode($data, &$filename = '', &$error = '', $maxlength = null) ,把这个函数用下面的代码包括起来即可。
立即学习“PHP免费学习笔记(深入)”;
if (! function_exists('gzdecode')) {
//将gzdecode函数包括进来
}以上就介绍了PHPRPC的简单使用,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号