Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
文字列を出力するゲームサーバーを実行するコマンドをphpを使用して実行しています。文字列からpidを解析して保存し、後でそれを使用してプロセスを強制終了できるようにする必要があります。
"...server daemon started with pid=6849 (parent=6848)."
したがって、6849が返されます。
if (preg_match('/pid=(\d+)/', $string, $matches) { $pid = $matches[1]; }