简体   繁体   English

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

[英]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.

相关问题 我可以使用Jython将Java库与我的Python代码链接吗 - Can I link a Java library using Jython with my code in Python 如何用Java编写此Python代码(使用定界符解析一个整数字符串)? - How can I write this Python code in Java (parsing a string of ints, using delimiter)? 如何将Java代码快速转换为.NET(特别是ASP.NET)? - How can Java code be quickly converted to .NET (specifically, ASP.NET)? 如何使用pdfbox编写带有语法突出显示的java代码 - how can I write java code with syntax highlighting using pdfbox 如何使用eclipse中编写的Java代码在远程桌面中导航(例如,打开Mozilla)? - How can i navigate (e.g. open Mozilla) in a Remote Desktop by using java code written in eclipse? 如何衡量用Java编写的代码的速度? (AI算法) - How can I measure the speed of code written in Java? (AI algorithms) 我将如何在 java 中编写此 python 代码 - How would i write this python code in java 如何使用Ruby或PHP或Java解析/学习/提取ASP.net网站内容? - How to parse/leach/extract a ASP.net website Content using Ruby or PHP or Java? 如何用Java编写此等效代码? - How can I write this equivalent code in Java? 如何从Java触发以python编写的代码? - How to trigger an code written in python from java?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM