<?php /*** * 执行的 linux 下的命名管理类 * Class clsCmd */ class clsCmd implements ICmd { public $_error_code = 1; public $_output = []; public $rs; private int $_time_out = 30; public function __construct(private $_cmd = '',private $_module='',private $_func='') { $this->_exec(); } public function _exec(){ if(!$this->_cmd) return ; unset($this->_output); if(is_string($this->_cmd)){ if(str_contains($this->_cmd,'curl')){ $this->_cmd .= ' -m '.$this->_time_out; } $this->rs = exec($this->_cmd,$this->_output,$this->_error_code); }else if(is_array($this->_cmd)){ foreach ($this->_cmd as $cmd){ $this->rs = exec($cmd,$this->_output,$this->_error_code); } } } public function _handExec() { // TODO: Implement _handExec() method. } public function _handRexec() { // TODO: Implement _handRexec() method. } }
PHP 与底层 linux 命令 混合开发 类
于 2022-06-29 17:43:27 首次发布