|
PHP5中文手册
PHP / Java Integration简介There are two possible ways to bridge PHP and Java: you can either integrate PHP into a Java Servlet environment, which is the more stable and efficient solution, or integrate Java support into PHP. The former is provided by a SAPI module that interfaces with the Servlet server, the latter by this Java extension. The Java extension provides a simple and effective means for creating and invoking methods on Java objects from PHP. The JVM is created using JNI, and everything runs in-process. Warning
本扩展模块是实验性的。本模块的行为,包括其函数的名称以及其它任何关于此模块的文档可能会在没有通知的情况下随 PHP 以后的发布而改变。使用本扩展模块风险自担。 需求You need a Java VM installed on your machine to use this extension. 安装本 » PECL 扩展未绑定于 PHP 中。 在 PHP 4 中本 PECL 扩展的源程序位于 PHP 源程序中的 ext/ 目录下或者在上面的 PECL 连接中。 In order to use these functions you must compile PHP with Java support by using the --with-java[=DIR] where DIR points to the base install directory of your JDK. This extension can only be built as a shared extension. Additional build extensions can be found in php-src/ext/java/README. Windows users will enable php_java.dll inside of php.ini in order to use these functions. 在 PHP 4 中本 DLL 位于 PHP Windows 执行包中的 extensions/ 目录下。 可以从 » PHP 下载页面或者 » http://snaps.php.net/ 下载此 PECL 扩展的 DLL 文件。
运行时配置这些函数的行为受 php.ini 的影响。
资源类型本扩展模块未定义任何资源类型。 预定义常量本扩展模块未定义任何常量。 范例
Example#1 Java Example
<?php Example#2 AWT Example
<?php
Java Servlet SAPIThe Java Servlet SAPI builds upon the mechanism defined by the Java extension to enable the entire PHP processor to be run as a servlet. The primary advantage of this from a PHP perspective is that web servers which support servlets typically take great care in pooling and reusing JVMs. Build instructions for the Servlet SAPI module can be found in php4/sapi/README. Notes:
Table of Contents
|