As the title explains, I want to maintain an information across requests from multiple clients. Let me put in a simple example to explain what I want. This example is just for illustration of my question and not the purpose of the post.
正如标题所解释的那样,我希望维护来自多个客户端的请求的信息。让我举一个简单的例子来解释我想要的东西。这个例子只是为了说明我的问题而不是帖子的目的。
Example: I want to count the total number of requests that a server has had so far from all the clients for different php scripts. I mean the TOTAL number of requests that comes from MULTIPLE different clients for MULTIPLE DIFFERENT pages. I now will have an extension that reads that global count and returns it for the PHP programmer.
示例:我想计算服务器到目前为止针对不同php脚本的所有客户端的请求总数。我的意思是来自MULTIPLE不同客户端的多个不同页面的TOTAL请求数。我现在将有一个扩展,读取全局计数并返回给PHP程序员。
Super global variables that the zend provides are persistent just across multiple requests from same client. Does anyone know how and where to store the variable and the way to retrieve it as well?
zend提供的超级全局变量仅在来自同一客户端的多个请求中持久存在。有谁知道存储变量的方式和位置以及检索它的方法?
1 个解决方案
#1
1
The only way is to use some form of Inter-process communication. For instance, you could use shared memory (but you'll have to synchronize the access to it).
唯一的方法是使用某种形式的进程间通信。例如,您可以使用共享内存(但您必须同步对它的访问)。
Remember the most common way to run PHP is without thread support – multiple processes, one process serving only one client at a time. The reason is that PHP is substantially faster in this configuration.
请记住,运行PHP的最常见方式是没有线程支持 - 多个进程,一个进程一次只为一个客户端提供服务。原因是PHP在这种配置中要快得多。
#1
1
The only way is to use some form of Inter-process communication. For instance, you could use shared memory (but you'll have to synchronize the access to it).
唯一的方法是使用某种形式的进程间通信。例如,您可以使用共享内存(但您必须同步对它的访问)。
Remember the most common way to run PHP is without thread support – multiple processes, one process serving only one client at a time. The reason is that PHP is substantially faster in this configuration.
请记住,运行PHP的最常见方式是没有线程支持 - 多个进程,一个进程一次只为一个客户端提供服务。原因是PHP在这种配置中要快得多。