Home > Backend Development > PHP Tutorial > php pcntl_fork怎么关闭子进程

php pcntl_fork怎么关闭子进程

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-06 20:23:22
Original
2245 people have browsed it

php pcntl_fork怎么关闭子进程

回复内容:

php pcntl_fork怎么关闭子进程

exit(0)//理论上这样是可以的,实际上这个进程会一直在,不知道为啥(php+apache)

posix_kill(posix_getpid(),SIGTERM);

另:实际使用时如果主进程要先退出,子进程继续执行的话,需要fork两次,让子进程退出再关闭父进程,直接业务逻辑让孙进程去执行

Related labels:
php
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template