日期:2011-05-23 浏览次数:20485 次
[java] extension=PHP_java.dll java.home = C:\jdk1.3.1_01 java.library = C:\jdk1.3.1_01\jre\bin\CLASSIC\jvm.dll java.library.path=C:\PHP4\extensions\ java.class.path="C:\PHP4\java\PHP_java.jar;C:\PHP4\java\" |
<?PHP $system = new Java("java.lang.System"); print "Java version=".$system->getProperty("java.version")." n"; print "Java vendor=".$system->getProperty("java.vendor")." print "OS=".$system->getProperty("os.name")." ".$system->getProperty("os.version")." on ".$system->getProperty("os.arch")."\n"; |
Java version=1.3.1_01 Java vendor=Sun Microsystems Inc. OS=Windows 98 4.10 on x86 星期一, 十一月 26, 2001 at 9:45:53 上午 Greenwich Mean Time |
public class PHPtest{ public String myvalue; public String setValue(String v){ myvalue=v; return myvalue; } public static void main(String args[]){ PHPtest p = new PHPtest(); if(args.length == 0) { System.out.println("Not Set!"); }else{ for (int i=0; i < args.length; i++) { String arg = args[i]; System.out.println(p.setValue(arg)); } } } } |
<?PHP $myobj = new Java("PHPtest"); echo $myobj->setValue("Hello,PHP and Java world!"); ?> |