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...