如何从Java执行PHP脚本?

如何从Java执行PHP脚本?,第1张

如何从Java执行PHP脚本
public class URLConnectionReader {    public static void main(String[] args) throws Exception {        URL yahoo = new URL("http://www.yahoo.com/");        URLConnection yc = yahoo.openConnection();        BufferedReader in = new BufferedReader(          new InputStreamReader(          yc.getInputStream()));        String inputLine;        while ((inputLine = in.readLine()) != null)  System.out.println(inputLine);        in.close();    }}

摘录来自官方Java教程(http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html)。这应该对您有帮助。



欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5586896.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-12-15
下一篇2022-12-15

发表评论

登录后才能评论

评论列表(0条)

    保存