title: "WP_CLI\Utils\proc_open_compat()" post_status: publish comment_status: open taxonomy: category: - wp-cli-handbook post_tag: - Internal Api - Repos - Data
WP_CLI\Utils\proc_open_compat()
Windows 兼容的 proc_open()。解决 PHP 中的错误,并处理类 Unix 的 ENV_VAR=blah cmd 环境变量前缀。
用法
WP_CLI\Utils\proc_open_compat( $cmd, $descriptorspec, $pipes, $cwd = null, $env = null, $other_options = null )
$cmd (string) 要执行的命令。
list<string>|resource> (array<int,) $descriptorspec 描述符编号及其值的索引数组。
resource> (array<int,) &$pipes 与 PHP 端创建的任何管道对应的文件指针索引数组。
$cwd (string) 命令的初始工作目录。
string> (array<string,) $env 环境变量数组。
$other_options (array<string>) 附加选项数组(仅限 Windows)。
array<int, (@param-out) resource> $pipes
@return (resource|false) 已去除任何环境变量设置的资源,失败时返回 false。
list<string>|resource> (array<int,) $descriptorspec 描述符编号及其值的索引数组。
resource> (array<int,) &$pipes 与 PHP 端创建的任何管道对应的文件指针索引数组。
$cwd (string) 命令的初始工作目录。
string> (array<string,) $env 环境变量数组。
$other_options (array<string>) 附加选项数组(仅限 Windows)。
array<int, (@param-out) resource> $pipes
@return (resource|false) 已去除任何环境变量设置的资源,失败时返回 false。
内部 API 文档在每次发布时从 WP-CLI 代码库生成。要提出改进建议,请提交一个拉取请求。
相关
- WP_CLI\Utils\write_csv() - 将数据作为 CSV 写入给定文件。
- WP_CLI\Utils\http_request() - 向远程 URL 发出 HTTP 请求。
- WP_CLI\Utils\get_named_sem_ver() - 比较两个版本字符串以获取命名的语义版本。
- WP_CLI\Utils\parse_ssh_url() - 解析 SSH URL 以获取其主机、端口和路径。
- WP_CLI\Utils\basename() - 独立于区域设置的 basename() 版本
- WP_CLI\Utils\isPiped() - 检查当前脚本的输出是 TTY 还是管道/重定向
- WP_CLI\Utils\esc_like() - 在为 MySQL 准备之前,对 LIKE 特殊字符 % 和 _ 进行转义的第一部分。