import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class Test {
public static void main(String[] args) {
ProcessBuilder p=new ProcessBuilder(
"D:\\wamp\\bin\\php\\php5.6.25\\php.exe",//php.exe是PHP解释器执行的exe文件
"H:\\00\\00xa\\CodeCharge\\TestJavaPHP\\src\\test.php"//test.php是php源代码
);//ProcessBuilder类和Process类属于java.lang包
try {
Process pp=p.start();
InputStream is=pp.getInputStream();
InputStreamReader isr=new InputStreamReader(is);
char[] ch=new char[1024];
isr.read(ch);
System.out.println(ch);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();