PHP scripts 8 Skills (7) PHP and Java

zhaozj2021-02-12  191

8 tips for PHP scripts (7) PHP and Java2004-05-23 Netant Ozers

PHP and Java

Another trick for the PHP function is the ability to call the method of the Java object, which allows you to integrate PHP integrate the existing Java-based application. If you are promoting PHP in your workplace, then you have found a big blow to blow, you know, Java this game is everywhere.

To use this feature, you need to install Java Virtual Machine (JVM) on the server. If you intend to install (or already installed) from Sun, Kaffe, IBM, or Blackdown's JDK, then you can now get a corrective.

When you configure PHP, you will need to add the "Java parameters to the configuration instruction, then modify your php.ini file. PHP.INI usually wants to modify the following lines:

[Java]

Java.library.path = / path / to / librage

Java.class.path = / classpath /

EXTENSION_DIR = / Path / to / Extensions

EXTENSION = libphp_java.so

However, please note that these modifications depends on your installation type. You should read the ReadMe file in the ext / java directory in your PHP installation directory for more information on Java feature settings.

The following is a simple example: Create a PHP script for a new Java object. This script will then get some Java attributes and printed. This is also a very good COM example.

$ system = new java ("java.lang.system");

Echo "P> Java Version =". $ system-> getproperty ("java.version"). "
";

Echo "java vendor =". $ system-> getproperty ("java.vendor"). "";

?>

If you have already mastered the knowledge of Java, you must help developers do this project. These types of integration features must be the key to PHP development and the key accepted by people. Therefore, more people do these work, PHP's future will be more beautiful.

转载请注明原文地址:https://www.9cbs.com/read-7416.html

New Post(0)