我想在 python 中编写基于 PHP 的 thrift API 客户端,例如 thirft.apache.org 示例客户端:http: //thrift.apache.org/
我写了这段代码:
//A struture
$up = UserProfile($uid=1,
$name="Mark Slee",
$blurb="I'll find something to put here.");
# Talk to a server via TCP sockets, using a binary protocol
$fp = fsockopen("localhost",9090, $errno, $errstr, 90);
# Use the service we already defined
$service=fwrite($fp, $up);
while (!feof($fp)) {
echo fgets($fp, 128);
}
那么它是python客户端代码的正确替代方案吗:http: //thrift.apache.org/
请提出任何建议,因为我是新手。
谢谢