0
我有这样的数据,算术了shell_exec()返回0 PHP
field1,field2
test,11
test,3
test,14
test,200
test,8
,我要总结的所有域2。我使用shell_exec。
$execute = 'x=0;for i in `cut -d\',\' -f2 /app/tibs/tosweb/CCS1/tos/temp/test2.txt`; do let x+=i; echo $x; done';
$output = shell_exec($execute);
echo "<pre>".var_export($output, TRUE)."</pre>\\n";
我不明白,为什么x的值总是返回0? 请帮助我的朋友,谢谢你。
*对不起我的英文不好:P
以前我用引号,我用双引号。如果我使用双引号,返回值总是字符串(0)。 我尝试在其他服务器正常工作的代码。我试过这个在我的服务器: shell_exec(“echo $((10 + 5))”); 并且返回值为NULL。为什么如果我使用aritmetich操作不起作用? –
我试过我的代码,它工作正常。你能够从SSH cli运行命令吗? – AlecTMH