Integration of PHP and Java

Source: Internet
Author: User

Finally, I found an excellent integration solution --- Quercus.

Quercus are integrated into resin and can be stored in Tomcat and other containers, But it is said that they are best combined with resin.

Install Resin step: http://www.caucho.com/resin-3.0/quercus/tutorial/hello/index.xtp

Quercus now supports php5.2. Follow the steps above to install PHPProgramDirectly deploy it in resin. php, JSP, and Java can be deployed in resin together without installing PhP5, which is very simple.

 

 

PHP calls Java class:
<? Php <br/> echo "Current Time:/R"; <br/> $ A = new Java ("Java. util. date "); <br/> echo $ A-> time; <br/>?>

 

PHP calls Java instance method:

 

<? Php <br/> echo "Current Time:/R"; <br/> $ A = new Java ("Java. util. date "); <br/> echo $ A-> gettime (); # callgettime () <br/> echo $ A-> settime (456 ); # callsettime (456) <br/> echo $ A-> time; # callgettime () <br/> $ A-> time = 456; # callsettime (456) <br/> echo $ A-> time; <br/>?> <Br/>

 

 

For more information about how to call Java object methods, import classes, type conversion, sharing Java connection pools with PHP, and setting PHP compilation to improve performance, see:

Http://quercus.caucho.com/quercus-3.1/doc/quercus.xtp

 

In addition, there is also a scheme called PHP and Java bridging scheme, which is more troublesome than Quercus:

Http://php-java-bridge.sourceforge.net/pjb/index.php

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.