没有合适的资源?快使用搜索试试~ 我知道了~
PHP通过ice调用python程序.pdf
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 102 浏览量
2021-11-29
19:07:04
上传
评论
收藏 18KB PDF 举报
温馨提示
试读
5页
PHP通过ice调用python程序.pdf
资源推荐
资源详情
资源评论
PHP 通过 ice调用 python程序
PHP 能调用 python 程序是不是一件很爽的事情, 有很多大型的处理简单用 PHP 是不能完成,
我们就可以通过 ice 中间件调用 python 来完成。首先创建一个 Slice 文件 Hello.ice
#ifndef HELLO_ICE
#define HELLO_ICE
module Demo
{
interface Hello
{
["cpp:const"] idempotent void sayHello(int delay);
["cpp:const"] idempotent string returnHello();
string test(string name);
void shutdown();
};
};
#endif
有了接口文件,开始创建一个 python 服务端 Server.py,代码如下
import sys, traceback, time, Ice
Ice.loadSlice( “ Hello.ice ”)
import Demo
class HelloI(Demo.Hello):
def sayHello(self, delay, current=None):
if delay != 0:
time.sleep(delay / 1000.0)
print "Hello World! aaaaaaaa"
def returnHello(self, current=None):
print current
return “ hello ”
def test(self, name, current=None):
return name
def shutdown(self, current=None):
current.adapter.getCommunicator().shutdown()
class Server(Ice.Application):
资源评论
筱筱笎琞
- 粉丝: 9
- 资源: 15万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功