这是我的php内容
<html>
<?php
$current="";
$answer="";
if(!empty($_POST))
{
$descriptorspec = array(
0 => array("pipe", "w"),
1 => array("pipe", "w"),
2 => array("file", "tmp/error-output.txt", "a")
);
$current=$_POST['t1'];
$file="hello.cpp";
file_put_contents($file,$current);
putenv("PATH=C:\Program Files (x86)\Dev-Cpp\MinGW64\bin");
$process = proc_open('g++ -Wall -o hello hello.cpp', $descriptorspec, $pipes);
if (is_resource($process)) {
fwrite($pipes[0],"12");
fwrite($pipes[0],"/n");
fwrite($pipes[0],"12");
$answer=shell_exec("hello.exe");
fclose($pipes[0]);
$return_value = proc_close($process);
}
}
?>
<style>
.txtarea{
width:300px;
height:500px;}
</style>
<form method="POST">
<textarea name="t1" placeholder="Enter c++ code" class="txtarea"><?php echo $current; ?></textarea>
<input type="submit" value="run">
<textarea name="t2" class="txtarea"><?php echo $answer; ?></textarea>
<br>
<textarea name="t3" class="t"><?php echo $return_value; ?></textarea>
</form>
</html>
&#13;
的输入的程序
#include<stdio.h>
int main()
{
int a,b,c;
scanf("%d%d",&a,&b);
printf("Addition = %d",(a+b));
return 0;
}
我得到输出为&#34; 1&#34;不明白为什么 请帮我把输入存储到变量a和b并显示总和...... 提前致谢