xmlrpc分布式计算 <?php //server/server.php include('class-IXR.php'); class ihefeServer extends IXR_Server { function ihefeServer() { $this->IXR_Server(array( 'i.h' => 'this:sayHello', 'i.get' => 'this:set_get', 'i.echos' => 'this:echos', 'i.arr' => 'this:return_array' )); } function set_get($get) { $g1=$get[0]; $g2=$get[1]; $g3=$get[2]; $g4=$get[3]; $g5=$get[4]; return $g1.$g2.$g3.$g4.$g5; } function echos($get) { return $get; } function sayHello($args) { return 'Hello哈哈哈!'; } function return_array() { $arr=array( array( 'id'=>1,'name'=>"hs",'sex'=>'男' ), array( 'id'=>1,'name'=>"hs",'sex'=>'男' ) ); return $arr; } } $serverd = new ihefeServer(); ?> <?php //client/client.php include('class-IXR.php'); header("Content-Type:text/html;charset=utf-8"); $client = new IXR_Client('http://localhost/server/server.php'); //$client = new IXR_Client('localhost','/ixr-new/server/server.php',80); //$client->debug = true; function show() { global $client; if($client) {$response = $client->getResponse();} else{echo "<h2>ihefe::Error! ".$client->getErrorCode().":".$client->getErrorMessage().'</h2>';} print_r($response); echo "<br/><hr/><br/>"; } // Run a query for PHP $client->query('i.h'); show(); $client->query('i.get','a',1.22*5,1/2,0.8899999,5*0); show(); $client->query('i.echos','a',1.22*5,1/2,0.8899999,5*0); show(); ?>