Another advantage of php is its ability to call existing java object methods. This function can be used to integrate PHP into existing Java-based applications. This feature is especially trendy if you are promoting PHP at work. "Java is everywhere ." To implement this function, you need to install the Java virtual machine (JVM) on the server ). If you want to install (or have installed) JDK from Sun, Kaffe, IBM, or Blackdown, another advantage of quickly starting the php function is its ability to call existing java object methods. This function can be used to integrate PHP into existing Java-based applications. This feature is especially trendy if you are promoting PHP at work. "Java is everywhere ."
To implement this function, you need to install the Java virtual machine (JVM) on the server ). If you want to install (or have installed) JDK from Sun, Kaffe, IBM, or Blackdown, you can get started quickly.
When configuring PHP, add the -- with-java parameter to the configuration command and modify some elements in the php. ini file. Modify the following lines in php. ini:
[Java]
Java. library. path =/path/to/library
Java. class. path =/classpath/
Extension_dir =/path/to/extensions
Extension = libphp_java.so
Note that the above modifications depend on your installation type. Read the README file in the ext/java directory of your PHP installation directory to learn more about Java function configuration.
Here is a simple example: create a new Java object using a PHP script. The script then accesses some Java attributes and outputs them. This is as exciting as the COM instance, but this example also gives you more possibilities.
$ System = new Java ("java. lang. System ");
Echo"
Java version = ". $ system-> getPRoperty (" java. version ")."
";
Echo "Java vendor =". $ system-> getProperty ("java. vendor ")."
";
?>
If you already have Java knowledge, you should do your best to help developers in this project. Such integration capabilities will inevitably become the key to PHP development and human acceptance in the future. Therefore, the more people who do these jobs, the better the future development of PHP.