PHP服务器响应执行批处理文件的android时, [英] Php server response to android when executing a batch file

查看:130
本文介绍了PHP服务器响应执行批处理文件的android时,的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,它是在Java和放大器;我创建了应用程序和放大器的一个批处理文件(.bat);在这样的PHP运行它

I have an application which is in java & i have created a batch file(.bat) of that application & running it in php like this

   <?php
      system ("cmd.exe /c final.bat");
   ?>

输出是这样的

C:\\ WAMP \\ WWW \\ PHP> Java的罐子最密切reseambling是这样的...... C:\\ WAMP \\ WWW \\ PHP>暂停preSS任意键继续。 。

C:\wamp\www\php>java -jar Most closely reseambling is this...C:\wamp\www\php>pause Press any key to continue . . .

我通过我的Andr​​oid应用程序与放大器调用此;希望这一点作为回应......你能告诉我如何做到这一点....这将是巨大的,如果我能够从响应消除提示。

I am invoking this through my android application & want this out as response...Can you tell me how to do this .... It would be great if I would be able to eliminate prompts from response.

推荐答案

检查出的 exec函数。而不是自动打印输出,它会返回的输出作为一个字符串,或者在第二个参数线路的可选阵列。然后,您可以解析这个字符串或数组,你只需要打印的东西。

Check out the exec function. Instead of automatically printing the output, it will return the output as a string, or in an optional array of lines in the second argument. You can then parse this string or array and print only what you need.

例子将打印所有,但输出的第一行:

Example which would print all but the first line of output:

exec('cmd.exe /c final.bat',$output);
for($i = 1; $i < count($output); ++$i) echo $output[$i],'<br />';

这篇关于PHP服务器响应执行批处理文件的android时,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆