我正在使用php执行命令来运行输出字符串的游戏服务器。我需要从字符串中解析出 pid,以便我可以保存它,然后在以后使用它来终止进程。
"...server daemon started with pid=6849 (parent=6848)."
所以它会返回 6849。
if (preg_match('/pid=('d+)/', $string, $matches) {
$pid = $matches[1];
}
我正在使用php执行命令来运行输出字符串的游戏服务器。我需要从字符串中解析出 pid,以便我可以保存它,然后在以后使用它来终止进程。
"...server daemon started with pid=6849 (parent=6848)."
所以它会返回 6849。
if (preg_match('/pid=('d+)/', $string, $matches) {
$pid = $matches[1];
}
或
之后插入一个