Home >Backend Development >PHP Tutorial >PHP如何获得当前的进程id?

PHP如何获得当前的进程id?

PHPz
PHPzOriginal
2016-06-06 20:14:435944browse

PHP如何获得当前的进程id?

PHP如何获得当前的进程id?

在PHP中,可以使用posix_getpid()来获得当前的进程id。

posix_getpid

posix_getpid — 返回当前进程 id

说明:

posix_getpid ( void ) : int

Return the process identifier of the current process. 返回当前进程的 id

返回值:

  • 返回进程 id 号,是整型(integer)。

示例:

<?php
echo posix_getpid(); //8805
?>

注:posix_getpid在windows上不起作用。

推荐教程:PHP视频教程

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn