globaltriangles / shell-commander
扩展,允许直接在支持一般输出和错误的服务器上执行shell命令
1.1.0
2021-09-23 17:53 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-09-20 08:50:47 UTC
README
这是一个小的php composer插件,用于在执行过程中支持常规输出和错误的shell命令执行
安装
使用包管理器 composer 安装shell-commander。
composer require globaltriangles/shell-commander
用法
use ShellCommander\Commander; //the string of the command to execute is this case a simple ls $command = 'ls'; //Call the static method an Execute the command saving the outputs to a variable $exec = Commander::exec($command); if(! empty($exec['output'])) { //Do Something with the output string like so... echo $exec['output']; } if(! empty($exec['error'])) { //Do Something with the error string like so... echo $exec['error']; }
贡献
欢迎拉取请求。对于重大更改,请首先创建一个问题来讨论您想进行哪些更改。