在PHP中运行外部CPP代码 [英] Running an external cpp code in php

查看:65
本文介绍了在PHP中运行外部CPP代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个cpp代码,它通过蓝牙从设备读取一些信息,并将其写入txt文件.它可以正常工作.

我也有一个php网页(在localhost中),我想从我的php页面运行此cpp可执行文件.

我使用了exec函数,但是当我单击相关按钮时,它不起作用.可能是安全问题.

我的php代码:

Hi Everybody,

I have a cpp code reading some information from a device via bluetooth and writes it to a txt file. it works properly.

Also I have a php web page (in localhost) and I want to run this cpp executable from my php page.

I used exec function but when i click the relevant button it does not work. may be it is a security issue.

My php code:

<?php
	$cmd = "C:\Users\wecare\Desktop\help\comport\Debug\comport.exe";
?>		
<button type="button"  onclick= "<?php exec ($cmd);  ?>" 

<p align="center" class="style12">OK</p>
</button>


有帮助吗?
谢谢.


Any help?
Thanks.

推荐答案

cmd = " ; ?> < 按钮 =" 按钮" =" <?php exec(
cmd = "C:\Users\wecare\Desktop\help\comport\Debug\comport.exe"; ?> <button type="button" onclick= "<?php exec (


cmd);?>" < p align =" =" < > < /button >
cmd); ?>" <p align="center" class="style12">OK</p> </button>


有帮助吗?
谢谢.


Any help?
Thanks.


这是不允许的,因为它违反了Web浏览器的安全规则.
This is not allowed as it breaches the security rules for web browsers.


这篇关于在PHP中运行外部CPP代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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