package test; public class HelloWorld { public static final String JAVABRIDGE_PORT = "8080";//这个8080端口是Java.inc里指定的 static final php.java.bridge.JavaBridgeRunner runner = php.java.bridge.JavaBridgeRunner .getInstance(JAVABRIDGE_PORT); public static void main(String args[]) throws Exception { runner.waitFor();//会停在这 } public void hello(String args[]) throws Exception { System.out.println("!!!" + args[0]); } } <?php require_once("C:\Users\Administrator\workspace\JavaPhp\Java.inc"); #require_once("http://localhost:8080/Java.inc");#这个http的方式报错,浏览器上可以访问的前提下 $world = new java("test.HelloWorld");#包名不写不行 echo $world->hello(array("from PHP")); ?>