exec 执行结果以数组返回
最后更新于:2022-04-02 02:32:21
[TOC]
## exec 以数组形式返回输出
```
@exec("ps -ef | grep Up",$op);
print_r($op);
/*
Array
(
[0] => im_user 2640 1 0 17:05 ? 00:00:03 ./UpMessageServer
[1] => im_user 2848 1 0 17:05 ? 00:00:01 ./UpOrgServer
[2] => im_user 2945 1 0 17:05 ? 00:00:01 ./UpLoginServer
)
*/
```
## 系统命令如运行失败,使用觉得路径
```
bad
@exec("ip addr", $return_array);
good
@exec("/usr/sbin/ip addr", $return_array);
```
';