Two Methods for php to call Java objects

Source: Internet
Author: User
Tags php compiler


1. Java module of php

The php release contains a Java extension module that can be used to call Java objects. For example:

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


2. Implementation of the mini J2EE Application Server SJOP Protocol

The main purpose of implementing the sjop protocol on the minij2ee application server is to enable php to access EJB enterprise components. Therefore, minij2ee provides a EJB-PHP compiler that can compile EJB components into php classes, this allows php programs to conveniently call EJB components, for example:

<? Php
Require ("Cart. php"); // Cart. php is the php class definition of Cart EJB generated after the Cart EJB is compiled.
.

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

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.