Home  >  Article  >  Backend Development  >  Two ways for PHP to call Java objects_PHP tutorial

Two ways for PHP to call Java objects_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 16:09:461295browse


1.php's Java module

The PHP release version contains a Java extension module that can be used to call Java objects, for example:

$system=new Java( "java.lang.System");
print "Java version=".$system->getProperty("java.version")."
";
?>


2.minij2ee application server SJOP protocol implementation

The main purpose of minij2ee application server to implement SJOP protocol is to enable EJB enterprise-level components to be accessed in php, so minij2ee provides an EJB-PHP compiler that can Compile EJB components into PHP classes so that EJB components can be conveniently called in PHP programs, for example:

require("Cart.php"); //Cart.php is The php class definition of Cart EJB generated after compiling Cart EJB
.

$home=new CartHome(); //Create the Home interface of EJB.
$objref=$home->create($cart_name); //Create Cart EJB.
$cart=new Cart($objref);

$cart->add("some goods"); //Add an item to the shopping cart.​

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/314418.htmlTechArticle1.php Java module The php release version contains a Java extension module that can be used to call Java objects, such as :?php $system=newJava("java.lang.System"); print"Javaversion=".$system-getP...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn