PHPÓeJAVA
JAVAÊǸodz£Ç¿´oµÄ±a³ÌÀuÆ÷£¬ËuµÄÀ(C)Õ¹¿aÒ²ÊÇdz£µÄÓÐÓã¬Õaƪ½Ì³Ì£¬Ö÷Òª½²ÊoÔoÑuʹÓÃPHPµ÷Óù¦ÄÜÇ¿´oµÄJAVA Àa¿a(classes)¡£ÎªÁË*½±aÄaµÄѧϰ£¬Õaƪ½Ì³Ì½«°uÀ¨JAVAµÄ°²×°¼°Ò»Ð(C)»u±¾µÄÀý×Ó¡£
windowsϵݲװ
µÚÒ»²½£º°²×°JDK£¬ÕaÊÇdz£ÈÝÒ׵ģ¬ÄaÖ»Ðeһ»سµµÄ°²×°ºÃ¡£È»ºo×oºÃÒÔϲ½Öe¡£
ÔÚ Win9x ϼÓÈe £º¡°PATH=%PATH%;C:\jdk1.2.2\bin¡± µ½AUTOEXEC.BATÎļþÖÐ
ÔÚ NT /Win2000ϼÓÈe ¡°;C:\jdk1.2.2\bin¡±µ½»*¾³±aÁ¿ÖС£
ÕaÒ»²½ÊÇdz£ÖØÒªµÄ£¬ÕaÑuPHP²ÅÄÜÕýȵÄÕÒµ½Ðeµ÷ÓõÄJAVAÀa¡£
µÚ¶þ²½£ºÐÞ¸ÄÄaµÄPHP.INIÎļþ¡£
[java]
extension=php_java.dll
java.library.path=c:\web\php4\extensions\
java.class.path="c:\web\php4\extensions\jdk1.2.2\php_java.jar;c:\myclasses"
ÔÚPHP.INIÖмÓÈeextension=php_java.dll
²¢ÔÚ[java]ÖУ¬Ée¶¨ºÃjava.class.path£¬ÈÃËuÖ¸Ïophp_java.jar£¬Èç¹uÄaʹÓÃеÄJAVAÀa£¬ÄaÒ²Ó¦¸Ã´aeÈeÕa¸oÂ*¾¶£¬ÔÚÕaƪÀý×ÓÖУ¬ÎÒÃÇʹÓÃc:\myclassesÕa¸oĿ¼¡£
µÚÈý²½£º²aÊÔ»*¾³£¬´´½¨ÈçÏÂPHPÎļþ£º
<?
$system = new Java("java.lang.System");
print "Java version=".$system->getProperty("java.version")."\n";
print "Java vendor=".$system->getProperty("java.vendor")."\n\n";
print "OS=".$system->getProperty("os.name")." ".
$system->getProperty("os.version")." on ".
$system->getProperty("os.arch")."\n";
$formatter = new Java("java.text.SimpleDateFormat","EEEE,
MMMM dd, yyyy 'at' h:mm:ss a zzzz");
print $formatter->format(new Java("java.util.Date"))."\n";
?>
Èç¹uÄaÕýÈ*°²×°ÁË£¬Äa½«»a¿´µ½ÒÔÏÂÐÅÏ¢£º
Java version=1.2.2
Java vendor=Sun Microsystems Inc.
OS=Windows 95 4.10 on x86
Wednesday, October 18, 2000 at 10:22:45 AM China Standard Time
ÕaÑu£¬ÎÒÃǾÍÒѾ³É¹¦µÄ½¨Á¢ÆðÁË¿ÉÒÔʹÓÃJAVAÀaµÄPHPÔËÐл*¾³£¬ÎÒÃÇ¿ÉÒÔ¿ªÊ¼ÎÒÃǽÓÏÂÈ¥µÄ¿Î³ÌÁË¡£