{$this->type}(); $transport = new TBufferedTransport($socket, 1024, 1024); $protocol = new TBinaryProtocol($transport); $client = new $client($protocol); $transport->open(); array_unshift($param, $client); $result = call_user_func_array($callback, $param); //同步方式进行交互 /* $recv = $client->sayHello('Courages'); echo "\n sayHello11dd:".$recv." \n"; //异步方式进行交互 /* $client->send_sayHello('Us'); echo "\n send_sayHello \n"; $recv = $client->recv_sayHello(); echo "\n recv_sayHello:".$recv." \n"; */ $transport->close(); return $result; } private function socket() { return new TSocket($this->host, $this->port); } public function stream() { return new TPhpStream(TPhpStream::MODE_R | TPhpStream::MODE_W); } public function http() { return new THttpClient($this->host, $this->port, '/server.php'); } }