编译 C++使用PHP
我正在尝试使用 PHP 开发一个在 Linux 上托管的在线法官
我在 test.php 文件中编写了下面的代码
<?php
exec("sudo chown `rofaelemil` /var/www", $output, $returnVal);
exec("g++ /var/www/qwerty.cpp -o /var/www/binary", $output, $returnVal);
echo $output;
exec("cat /var/www/qwe.txt | /var/www/binary", $output, $returnVal);
echo $output;
exec("gcc /var/www/qwerty.c -o /var/www/binary", $output, $returnVal);
echo $output;
exec("cat /var/www/qwe.txt | /var/www/binary", $output, $returnVal);
echo $output;
?>
输出是
ArrayArrayArrayArray
任何人都可以配置问题吗
I'm trying to develop an online judge using PHP to be hosted on linux
I wrote the code below in test.php file
<?php
exec("sudo chown `rofaelemil` /var/www", $output, $returnVal);
exec("g++ /var/www/qwerty.cpp -o /var/www/binary", $output, $returnVal);
echo $output;
exec("cat /var/www/qwe.txt | /var/www/binary", $output, $returnVal);
echo $output;
exec("gcc /var/www/qwerty.c -o /var/www/binary", $output, $returnVal);
echo $output;
exec("cat /var/www/qwe.txt | /var/www/binary", $output, $returnVal);
echo $output;
?>
The output was
ArrayArrayArrayArray
Could anyone configure the problem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
$output
包含您逐行exec
的程序的输出,您无法回显数组,print_r
它。下次请查阅 php 的文档,你可以在那里得到这些信息。请参阅 exec。
$output
contains the output of the program youexec
ed, line by line, you can't echo an array,print_r
it.Next time please consult the documentation of php, you could have gotten this information there. See exec.