dqqt31923 2011-06-09 16:02
浏览 35
已采纳

如何在Java / ASP.NEt / Python中编写代码以使用用PHP编写的基于组件的库?

I have a component based library which is completely written in PHP and works like a charm.

A sample snippet of the code is :

<?php

require_once 'lib/my_class_file.php';

$variable1 = "some-value";
$variable2 = "some-value";

$new_variable = ClassName::newInstance(.....);

$new_variable->method_call($args);

?>

Now, I want to extend the use of this library to other platforms like Java, ASP.NET and Python. I don't know how can I consume this library in other languages like Java, ASP.NET and Python.

My concern is whether this is possible or not. If possible any pointer / online tutorials / sample code would be highly appreciated.

Thanks in advance.

  • 写回答

1条回答 默认 最新

  • dpy83214 2011-06-13 07:58
    关注

    A web service will be the common answer for your problem. In the past SOAP was popular - you can still use it, but it's probably better to use a simple REST server, or even better, use Thrift as a generic scalable solution. To use it, you first need to describe your data structures for your parameters and return value using a definition file, and then run a script which creates servers and clients for the various programming languages you will use.

    See also https://github.com/volca/thrift for a non-blocking port of the php server (I did not test it myself)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 outlook无法配置成功
  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题