[英]How can I write code in Java/ASP.NEt/Python for using a component based library written in PHP?
I have a component based library which is completely written in PHP and works like a charm.我有一个基于组件的库,它完全用 PHP 编写,并且工作起来很迷人。
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.现在,我想将此库的使用扩展到其他平台,例如 Java、ASP.NET 和 Python。 I don't know how can I consume this library in other languages like Java, ASP.NET and Python.我不知道如何以其他语言使用这个库,例如 Java、ASP.NET 和 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.提前致谢。
A web service will be the common answer for your problem. web 服务将是您问题的常见答案。 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.过去 SOAP 很流行——你仍然可以使用它,但使用简单的REST服务器可能更好,或者甚至更好,使用Thrift作为通用的可扩展解决方案。 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)另请参阅https://github.com/volca/thrift了解 php 服务器的非阻塞端口(我自己没有测试)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.