PHP exec() 清除输出
PHP exec() clear output
我有一个 PHP 文件 (file.php),其中包含以下代码:
<?php
exec("program.exe command",$output);
print_r($output);
?>
当在浏览器中打开 file.php 时,它会打印以下输出:
"Array ( [0] => my_output ) "
我只想打印 "my_output"。不是“Array ([0] =>
”部分。怎么做?
示例:
// Correct
print $arr['fruit']; // apple
print $arr['veggie']; // carrot
print $arr['fruit']; // apple
尝试使用此代码:
<?php
exec("program.exe command",$output);
echo $output[0];
?>
在以下位置阅读有关数组的更多信息:
我有一个 PHP 文件 (file.php),其中包含以下代码:
<?php
exec("program.exe command",$output);
print_r($output);
?>
当在浏览器中打开 file.php 时,它会打印以下输出:
"Array ( [0] => my_output ) "
我只想打印 "my_output"。不是“Array ([0] =>
”部分。怎么做?
示例:
// Correct
print $arr['fruit']; // apple
print $arr['veggie']; // carrot
print $arr['fruit']; // apple
尝试使用此代码:
<?php
exec("program.exe command",$output);
echo $output[0];
?>
在以下位置阅读有关数组的更多信息: