exec 执行一个外部程序 &reftitle.description; stringfalseexec stringcommand arrayoutput&null; intresult_code&null; exec 执行 command 参数所指定的命令。 &reftitle.parameters; command 要执行的命令。 output 如果提供了 output 参数, 那么会用命令执行的输出填充此数组, 每行输出填充数组中的一个元素。 数组中的数据不包含行尾的空白字符,例如 \n 字符。 请注意,如果数组中已经包含了部分元素,exec 函数会在数组末尾追加内容。如果你不想在数组末尾进行追加, 请在传入 exec 函数之前 对数组使用 unset 函数进行重置。 result_code 如果同时提供 outputresult_code 参数,命令执行后的返回状态会被写入到此变量。 &reftitle.returnvalues; 命令执行结果的最后一行内容。 如果你需要获取未经处理的全部输出数据, 请使用 passthru 函数。 失败时返回 &false;。 如果想要获取命令的输出内容, 请确保使用 output 参数。 &reftitle.errors; 如果 exec 无法执行 command,会发出 E_WARNING 如果 command 为空或者包含 null 字节,则抛出 ValueError &reftitle.changelog; &Version; &Description; 8.0.0 如果 command 为空或者包含 null 字节,exec 现在将抛出 ValueError。之前会发出 E_WARNING 并返回 &false;。 &reftitle.examples; <function>exec</function> 示例 ]]> &example.outputs.similar; cmb ) ]]> &reftitle.notes; &warn.escapeshell; ¬e.exec-bg; ¬e.exec-bypass-shell; &reftitle.seealso; system passthru escapeshellcmd pcntl_exec 执行运算符