如何通过bash命令在php中打印所有数组值?

时间:2016-09-07 15:50:21

标签: php arrays bash exec shell-exec

我的PHP脚本中有一个数组,

$args=array("red","green","blue","yellow");

我想执行一个打印数组的所有值的bash命令。

red
green
blue
yellow

我读了this问题和this one,我不想只是传递数组作为参数,我想打印我的数组的每个值,我试过这个

exec('echo ' . '"${args[@]}"');

但我得到了

sh: 1: Bad substitution

0 个答案:

没有答案