How does PHP call java code? New user request ~ There is a java file. for example, this function & nbsp; String & nbsp; test (String & nbsp; s) {& nbsp; String & nbsp; s2 & nbsp; do & nbsp; something & nbsp; deal & nbsp; with & nbsp; data & nbsp; basereturn & nbsp; s2 PHP how to call java code?
New user request ~
Now there is a java file. for example, there is this function in it.
String test (String s ){
String s2
// Do something deal with data base
Return s2;
}
There is also an html page. click a button to pass a string obtained from the page to the java function. The java function returns the result and displays it.
I don't know if this information is useful: I am using WAMPSever.
How can I enable PHP at the front end to call this java function? Thank you!
------ Solution --------------------
Tomacat + apache?
Then, your java code must be embedded!
And then use php to call it through socket or curl,
It should be enough.
------ Solution --------------------
1. php curl calls Java Servlet
2. write a WebService in Java and call it in PHP.