[李景山php]每天TP5-20170120|thinkphp5-Process.php-2

來源:互聯網
上載者:User

標籤:thinkphp5

/** * @var array */public static $exitCodes = [// 異常退出 代碼    0   => ‘OK‘,// 正常退出    1   => ‘General error‘,// 一般性錯誤    2   => ‘Misuse of shell builtins‘, // 缺少指令碼    126 => ‘Invoked command cannot execute‘,// 執行命令錯誤    127 => ‘Command not found‘,// 命令沒找到    128 => ‘Invalid exit argument‘,// 輸入 參數異常    // signals    129 => ‘Hangup‘,// 上行    130 => ‘Interrupt‘,// 中斷    131 => ‘Quit and dump core‘,// 退出 並且 列印 核心    132 => ‘Illegal instruction‘,//    133 => ‘Trace/breakpoint trap‘,    134 => ‘Process aborted‘,    135 => ‘Bus error: "access to undefined portion of memory object"‘,    136 => ‘Floating point exception: "erroneous arithmetic operation"‘,    137 => ‘Kill (terminate immediately)‘,    138 => ‘User-defined 1‘,    139 => ‘Segmentation violation‘,    140 => ‘User-defined 2‘,    141 => ‘Write to pipe with no one reading‘,    142 => ‘Signal raised by alarm‘,    143 => ‘Termination (request to terminate)‘,    // 144 - not defined    145 => ‘Child process terminated, stopped (or continued*)‘,    146 => ‘Continue if stopped‘,    147 => ‘Stop executing temporarily‘,    148 => ‘Terminal stop signal‘,    149 => ‘Background process attempting to read from tty ("in")‘,    150 => ‘Background process attempting to write to tty ("out")‘,    151 => ‘Urgent data available on socket‘,    152 => ‘CPU time limit exceeded‘,    153 => ‘File size limit exceeded‘,    154 => ‘Signal raised by timer counting virtual time: "virtual timer expired"‘,    155 => ‘Profiling timer expired‘,    // 156 - not defined    157 => ‘Pollable event‘,    // 158 - not defined    159 => ‘Bad syscall‘,];/** * 構造方法 * @param string         $commandline 指令 * @param string|null    $cwd         工作目錄 * @param array|null     $env         環境變數 * @param string|null    $input       輸入 * @param int|float|null $timeout     逾時時間 * @param array          $options     proc_open的選項 * @throws \RuntimeException * @api */public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = []){// 命令 工作目錄 環境變數 輸入 逾時時間 選項 數組    if (!function_exists(‘proc_open‘)) {// 如果進程 處理函數 不存在 則 報錯        throw new \RuntimeException(‘The Process class relies on proc_open, which is not available on your PHP installation.‘);    }    $this->commandline = $commandline;// 指令    $this->cwd         = $cwd;// 目錄    if (null === $this->cwd && (defined(‘ZEND_THREAD_SAFE‘) || ‘\\‘ === DS)) {//        // 如果目錄為空白,並且 定義了 zend_thread_safe 安全執行緒 並且 不是 windos 下        $this->cwd = getcwd();// 通過擷取 工作目錄的 方式 進行 擷取 資料    }    if (null !== $env) {// 如果環境變數 不為空白        $this->setEnv($env);// 設定環境變數    }    $this->input = $input;// 輸入擷取    $this->setTimeout($timeout);// 設定逾時時間    $this->useFileHandles               = ‘\\‘ === DS;// 是否使用文本處理    $this->pty                          = false;// 狀態    $this->enhanceWindowsCompatibility  = true;// 能夠執行視窗命令    $this->enhanceSigchildCompatibility = ‘\\‘ !== DS && $this->isSigchildEnabled();// 能夠執行 子命令    $this->options                      = array_replace([// 選項        ‘suppress_errors‘ => true,        ‘binary_pipes‘    => true    ], $options);}// 建構函式 就是 進行了 各種 函數的初始化public function __destruct()// 解構函式{    $this->stop();}public function __clone()// 複製函數{    $this->resetProcessData();}/** * 運行指令 * @param callback|null $callback * @return int */public function run($callback = null)// 運行 函數{    $this->start($callback);    return $this->wait();}


本文出自 “專註php 群號:414194301” 部落格,請務必保留此出處http://jingshanls.blog.51cto.com/3357095/1884579

[李景山php]每天TP5-20170120|thinkphp5-Process.php-2

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.