Chinaunix

标题: exec函数调用linux shell脚本,为什么返回参数$output是数组变量 [打印本页]

作者: plumdavid    时间: 2013-06-22 20:27
标题: exec函数调用linux shell脚本,为什么返回参数$output是数组变量
string exec ( string $command [, array &$output [, int &$return_var ]] )是PHP调用linux shell脚本函数。

其中,$output是linux shell脚本$command的返回值,我认为linux shell只能返回字符串,为什么$output是数组变量呢?
作者: plumdavid    时间: 2013-06-22 20:53

明白了。

exec把shell返回值按行划分成数组,每一行是一个数组元素。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2