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 a开发者_如何学Cnd 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.
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)
精彩评论