Java调用PHP 实例

WBOY
WBOYoriginal
2016-07-29 09:01:021132parcourir

Java调用PHP 实例

<code>package test;

import java.io.InputStream;
import java.io.InputStreamReader;

<span>public</span><span>class</span> Php {
    <span>public</span><span>static</span><span>void</span><span>main</span>(String args[]) throws Exception {
        ProcessBuilder pb = <span>new</span> ProcessBuilder(
                <span>"C:\\Users\\Administrator\\Desktop\\php-5.6.18-nts-Win32-VC11-x64\\php.exe"</span>,
                <span>"C:\\Users\\Administrator\\workspace\\JavaPhp\\src\\test\\test2.php"</span>);
        Process p = pb.start();
        InputStream <span>in</span> = p.getInputStream();
        InputStreamReader reader = <span>new</span> InputStreamReader(<span>in</span>);
        <span>char</span>[] buff = <span>new</span><span>char</span>[<span>1024</span>];
        reader.read(buff);
        System.<span>out</span>.println(buff);<span>//打印出!!!!!</span>
    }
}
</code>
<code><span><span><?php </span><span>echo</span><span>"!!!!!"</span><span>?></span></span></span></code>
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

以上就介绍了Java调用PHP 实例,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn