thinkphp - 多用户访问一个php程序,他们之间没有冲突,原理是什么?
过去多啦不再A梦
过去多啦不再A梦 2017-05-16 13:09:10
0
3
496

例如thinkphp程序中有一个class,它有一个属性为获取用户的referrer

if($_SERVER['HTTP_REFERER']==null){ $visitor_info.='&referrer='.'empty'; }else{ $visitor_info.='&referrer='.$_SERVER['HTTP_REFERER']; } $this->visitor_info=$visitor_info; //一个属性为获取用户的referrer

当同时有多个用户访问时,每个用户都有一个对应不冲突的 $this->visitor_info 是吗?

请问 并发访问不冲突,背后的原理是什么??

是不是每个用户访问时,都会在内存中划一块区域保存对应的引用??

过去多啦不再A梦
过去多啦不再A梦

reply all (3)
为情所困

Generally speaking, when a user establishes a connection access, the server will open a new process to serve the request. In this process, the PHP interpreter will read the contents of the PHP file and instantiate an object. This object will have a Reference, when the request ends, all data is recycled, and the reference no longer exists.

    PHPzhong

    That is, when each user accesses, the program enters the memory one by one and is processed by the CPU one by one. This should be related to CPU mechanism and memory-related knowledge. It's not a PHP problem. After a program is executed, there must be a result. Apache will return it after getting the result.

      我想大声告诉你

      Because php is in multi-process mode. . When accessing, each user is an independent process space

        Latest Downloads
        More>
        Web Effects
        Website Source Code
        Website Materials
        Front End Template
        About us Disclaimer Sitemap
        php.cn:Public welfare online PHP training,Help PHP learners grow quickly!