PHP calls Java language 1.php’s Java module
The php release version contains a Java extension module, Can be used to call Java objects, for example:
PHP calls Java language 2.minij2ee application server SJOP protocol implementation
Before introducing the minij2ee application server SJOP protocol implementation, let’s make it simple Introduce the minij2ee application server. The minij2ee application server is the first J2EE application server product that supports PHP, enabling PHP to be used to develop enterprise-level application systems. The full name of SJOP is Sample Java ORB Protocol (Simple Java Object Request Proxy Protocol), which is a simple and efficient object request proxy protocol. For example:
<ol class="dp-xml"> <li class="alt"><span><span class="tag"><</span><span> ?php </span></span></li> <li> <span>$</span><span class="attribute">conn</span><span>=</span><span class="attribute-value">minij2ee_fetch_connection</span><span>(); </span> </li> <li class="alt"> <span>print "Java </span><span class="attribute">version</span><span>=".minij2ee_<br>callstatic_</span><span class="attribute-value">java</span><span>obj($conn,"java.lang.<br>System","getProperty","java.lang.<br>String","java.version")." </span> </li> <li> <span class="tag"><</span><span class="tag-name">br</span><span class="tag">></span><span>/n"; </span> </li> <li class="alt"> <span class="tag">?></span><span> </span> </li> </ol>
<ol class="dp-xml"> <li class="alt"><span><span class="tag"><</span><span> ?php </span></span></li><li><span>require("Cart.php"); </span></li><li class="alt"><span>file://Cart.php是编译Cart <br />EJB后生成的Cart EJB的php类定义。</span></li><li class="alt"><span>$</span><span class="attribute">home</span><span>=</span><span class="attribute-value">new</span><span> CartHome(); </span></li><li><span>file://创建EJB的Home接口。</span></li><li><span>$</span><span class="attribute">objref</span><span>=$home-</span><span class="tag">></span><span>create($cart_name); </span></span></li> <li><span>file://创建Cart EJB。 </span></li> <li class="alt"> <span>$</span><span class="attribute">cart</span><span>=</span><span class="attribute-value">new</span><span> Cart($objref);$cart-</span><span class="tag">></span><span>add("some goods");</span> </li> <li class="alt"><span>file://向购物车中添加一个物品。 </span></li> <li> <span class="tag">?></span><span> </span> </li> </ol>