基于 PHP 的 thrift API 客户端,例如 thirft.apache.org python 中的示例客户端
我想用 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/
请给出任何建议,因为我是新手。
谢谢
I want to write PHP based thrift API client like thirft.apache.org example client in python at: http://thrift.apache.org/
I write this code:
//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);
}
so is it correct alternative of python client code at : http://thrift.apache.org/
Please give any suggestion as I am new to it.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看 Thrift Wiki 的 Thrift 使用 页面。其中有许多受支持语言的示例,特别是,有一个 PHP 示例客户端。
Look in the Thrift Wiki at the Thrift Usage page. That has examples in many supported languages, in particular, there's an example client in PHP.