duande3134 2012-06-11 14:41
浏览 101
已采纳

PHP脚本与应用程序通信的最佳方法?

I'm currently writing a c++ application for a linux server which basically handles requests (I haven't coded the part handling the requests yet, as I'm not sure of the best method).

Basically I have a PHP page that when fired (client hits the page) needs to communicate with the above mentioned application.

Now I can't fire off this application each time it's needed, as it's a rather complex application that needs to load data before it can do any processing (so it should just stay loaded forever as a daemon).

How would you suggest I have the PHP page make requests to the application? Should I just use socket programming with TCP/IP?

Thanks in advance!

  • 写回答

3条回答 默认 最新

  • dttphb59319 2012-06-11 14:51
    关注

    You could of course try and use raw sockets, but you don't need to. There are products that help you with what you want.

    I suggest you take a look at Apache Thrift. You can easily define what functions your C++ part offers and convert it into a daemon that waits for your requests from PHP. And of course there's a PHP library which you can use to make these requests.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度