8 tips for PHP scripts (7) PHP and Java_PHP tutorials

Source: Internet
Author: User
PHP script 8 skills (7) PHP and Java. Another trick of the PHP and JavaPHP features is its ability to call methods of existing Java objects. This feature allows you to integrate PHP into existing Java-based applications. If you are using your PHP and Java
Another trick of the PHP function is its ability to call methods of existing Java objects. This function allows you to integrate PHP into existing Java-based applications. If you are promoting PHP in your work, you can find the perfect spot. you know, Java is everywhere.
To use this function, you need to install the Java virtual machine (JVM) on the server ). If you plan to install (or have installed) JDK from Sun, Kaffe, IBM, or Blackdown, you are now on the right path.
When you configure PHP, you need to add the -- with-java parameter to the configuration command, and then modify your php. ini file. In php. ini, the following lines are usually modified:
[Java]
Java. library. path =/path/to/library
Java. class. path =/classpath/
Extension_dir =/path/to/extensions
Extension = libphp_java.so
However, note that the above modifications depend on your installation type. Read the README file in the ext/java directory under your PHP installation directory to learn more about Java function settings.
The following is a simple example: Create a PHP script for a new Java object. The script will then obtain some Java attributes and print them out. This is also a good example of COM.
$ System = new Java ("java. lang. System ");
Echo"
Java version = ". $ system-> getProperty (" java. version ")."
";
Echo "Java vendor =". $ system-> getProperty ("java. vendor ")."
";
?>
If you have mastered the Java knowledge, you must help the developer to do a good job in this project. These types of integration functions will inevitably be the key to PHP development and human acceptance in the future. Therefore, with more people doing this, the future of PHP will be even better.

Another trick of the PHP function is its ability to call methods of existing Java objects. This function allows you to integrate PHP into existing Java-based applications. If you are...

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.