For example, there is a class in the thinkphp program, which has an attribute to obtain the user's referrer
if($_SERVER['HTTP_REFERER']==null){
$visitor_info.='&referrer='.'empty';
}else{
$visitor_info.='&referrer='.$_SERVER['HTTP_REFERER'];
}
$this->visitor_info=$visitor_info; //An attribute is to obtain the user's referrer
When multiple users visit at the same time,each user has a corresponding $this->visitor_info that does not conflict, right?
Excuse me, there is no conflict in concurrent access. What is the principle behind it? ?
When each user accesses, will an area be allocated in the memory to save the corresponding reference? ?
为情所困2017-05-16 13:11:10
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.
PHPz2017-05-16 13:11:10
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.
我想大声告诉你2017-05-16 13:11:10
Because php is in multi-process mode. . When accessing, each user is an independent process space