PHPRPC is a lightweight, secure, cross-internet, cross-language, cross-platform, cross-environment, cross-domain, supports complex object transmission, supports reference parameter passing, supports content output redirection, and supports A hierarchical error-handling, session-enabled, service-oriented, high-performance remote procedure call protocol. To learn more please visit http://www.phprpc.com.
Click the link above to download the php version from the official website, and unzip the compressed package to the root directory of the website (mine is phprpc). Create two test files server.php and client.php in the root directory.
server.php code:
<?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 code:
<?php include ("php/phprpc_client.php"); $client = new PHPRPC_Client('http://localhost/server.php'); echo $client->HelloWorld(); ?>
if (! function_exists('gzdecode')) { //将gzdecode函数包括进来 }