[Perhaps the most painful part for experienced PHP programmers is the interpretation and running mechanism of PHP. This running mechanism allows all related resources to be recycled after each PHP page is interpreted and executed. That is to say, PHP cannot make an object resident in memory at the language level. In PHP, all variables are page-level, whether global variables or static classes
[Perhaps the most painful part for experienced PHP programmers is the interpretation and running mechanism of PHP. This running mechanism allows all related resources to be recycled after each PHP page is interpreted and executed. That is to say, PHP cannot make an object resident in memory at the language level. In PHP, all variables are page-level, whether global variables or static classes
[Perhaps the most painful part for experienced PHP programmers is the interpretation and running mechanism of PHP. This running mechanism allows all related resources to be recycled after each PHP page is interpreted and executed. That is to say, PHP cannot make an object resident in memory at the language level. In PHP, all variables are page-level. Whether it is a global variable or a static member of the class, they will be cleared after the page is executed]
[In PHP, if you want to share data between pages, you need to manually Save the variables to the predefined global variables $ GLOBALS or $ _ SESSION. PHP stores these variables in a file so that they can be read at the next page execution. However, this method has great limitations. In addition to low efficiency, it cannot save variables that reference external resources, such as files, sockets, and database connections, these resources need to be cached most]
[Even the simplest Singleton mode cannot be applied in PHP. Although Singleton code can be written in PHP, because PHP does not have a real global static variable, a new object will be created every time the page is executed, this completely loses the meaning of Singleton.]
It was hard to make up my mind to choose php, And I encountered such a flaw.
Php, tested by many applications, should not:
Since it is an application, it requires a lot of background resident information to be efficiently accessed (asp session is the most commonly used for building web applications)
What can't be imagined by php designers? For example:
Currently, three rooms in the game room are playing, and 4th People refresh the page. We should be able to see three rooms.
Of course, it may be related to the initial cgi Mode of php. Every time a page is explained, the interpreter exits, and the background resident information cannot be implemented.
However, fastcgi and isapi are available now, and the interpreter can be resident in the background, so it is not difficult to implement the resident information in the background.
Fastcgi has been used in so many languages for so long that it has not implemented background resident information.
Of course, you can use the same file, database, and memcache system to implement the information of the station resident. However, when there are more links, the efficiency will naturally be compromised.
Of course, sessions like asp interpreters are difficult to share sessions among multiple processes and servers in the memory of interpreter processes. Instead, they often have to rely on databases.
A lot of good languages are always a little bad, such as mssql T-SQL, actually only top n no skip m! The latest sql2012 is said to have started to support functions similar to skip m. At the beginning of sql2005, row_number () can achieve similar results, but its performance is slightly lower. Sql2000 paging can only be achieved through multiple top ups!