Another advantage of PHP functionality is its ability to invoke methods that already have Java objects. This feature allows PHP to be integrated into existing Java-based applications. This feature is especially fashionable if you're promoting PHP at work. "Java is everywhere. ”
To implement this feature, you need to install a Java Virtual machine (JVM) on the server. If you install (or have installed) a JDK from Sun, Kaffe, IBM, or Blackdown, you can start working quickly.
When you configure PHP, you need to add the--with-java parameter to the configuration directive and then modify some elements in the php.ini file. The following lines are typically modified in php.ini:
[Java]
Java.library.path=/path/to/library
java.class.path=/classpath/
Extension_dir=/path/to/extensions
Extension=libphp_java.so
It is up to you to remind that the above changes depend on your installation type. You should read the Readme file in the Ext/java directory under your PHP installation directory for more information about the Java feature configuration.
Here's a simple example: Create a new Java object from a PHP script. The script then accesses some Java properties and outputs them. This is as exciting as an instance of COM, but this example also lets you know more about the possible methods.
$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 on this project. Such integration capabilities must be the key to future PHP development and acceptance. So the more people who do these things, the better it will be for PHP to develop in the future.
http://www.bkjia.com/PHPjc/314481.html www.bkjia.com true http://www.bkjia.com/PHPjc/314481.html techarticle Another advantage of PHP functionality is its ability to invoke methods that already have Java objects. This feature allows PHP to be integrated into existing Java-based applications. If you are promoting in the workplace ...