Home > Backend Development > PHP Tutorial > Fastcgi调度线程解析php,那线程之间PHP中的静态属性(内存)是否是共享的?

Fastcgi调度线程解析php,那线程之间PHP中的静态属性(内存)是否是共享的?

WBOY
Release: 2016-06-06 20:38:43
Original
1246 people have browsed it

Fastcgi调度线程解析php,那线程之间PHP中的静态属性(内存)是否是共享的?因为fastcgi运行完一个php脚本,内存暂时不会释放,会接着调度处理下一个请求,那么之前php运行后的静态变量存储的值,下一个php会获取到吗?


class A { public statis $var; public static function init() { $var+=1; } } A::init();

下一个php运行时A::init();,$var的值是1还是2?

回复内容:

Fastcgi调度线程解析php,那线程之间PHP中的静态属性(内存)是否是共享的?因为fastcgi运行完一个php脚本,内存暂时不会释放,会接着调度处理下一个请求,那么之前php运行后的静态变量存储的值,下一个php会获取到吗?


class A { public statis $var; public static function init() { $var+=1; } } A::init();

下一个php运行时A::init();,$var的值是1还是2?

Php如果与nginx结合,它通过fpm管理,是多进程模型,进程之间是无法共享内存的。所以,你懂的

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template