Mantain是一个变量,通过几个脚本,如asp中的global.asa变量 [英] Mantain a variable through several scripts like global.asa variables in asp
问题描述
我必须从asp移植一个脚本,将ip添加到普通
文本或数组中的列表中。我不需要使用数据库或文件系统,它必须将b
存储在内存中以便为我们提供最佳性能(它应该连续访问
)。
我尝试使用apache_setenv(..)来定义$ _ENV变量,使用静态变量创建一个
类......但没有任何结果。
在asp中,脚本写了一个读取在
global.asa中定义的应用程序变量...是不可能移植的?这不是一个非常大的错误吗?
php?
谢谢
_ENV vars,使用apache_setenv(..),用静态var创建一个
类但没有结果。
在asp中,脚本写了一个读取在
global.asa中定义的应用程序变量...是否无法移植?这不是一个非常大的错误吗?
php?
谢谢
< blockquote> Zeppelin写道:
我必须从asp移植一个脚本,将ip添加到普通文本列表或数组。我不需要使用数据库或文件系统,它必须存储在内存中,以便为我们提供最佳性能(它应该被连续访问)。
最简单的方法就是在脚本顶部加一个文件。
进入文件你定义了一些常量或变量。
我已经尝试使用apache_setenv(..)定义
_ENV变量,创建一个<带有静态变量的类...但没有结果。
不要。
:-)
只需包含一个文件。
<在asp中,脚本写了一个读取在
global.asa中定义的应用程序变量......它是不可能移植的?这不是一个非常大的错误吗?
不,这不是一个大错误。
如果你担心性能,不要。
如果操作系统可以获得
,那么大量访问的文件将被放置在缓存(内存)中。
因此没有性能。
在旁注:我不明白为什么这么多人担心性能
当他们没有性能问题时。
我的猜测是超过90%的性能问题是数据库相关的
(错误查询,没有索引等)而不是脚本语言相关。
如果你绝对想要使用在PHP中共享内存,这是可能的。
我不记得包的名称,但是如果你环顾四周我肯定你会发现它是
。
我的建议是:只需要包含一个文件。
问候,
Erwin Moller
>谢谢
Hi,
I have to port from asp a script that adds an ip to a list in plain
text or an array. I need not using a database or filesystem, it has to
be stored in memory in order that giving us best performance (it should
be accessed continuously).
I''ve tried defining $_ENV vars, using apache_setenv(..), creating a
class with a static var... but nothing results.
In asp the script writes an reads an Application variable defined in
global.asa... is it impossible to port? isn''t it a very big error of
php?
thanks
_ENV vars, using apache_setenv(..), creating a
class with a static var... but nothing results.
In asp the script writes an reads an Application variable defined in
global.asa... is it impossible to port? isn''t it a very big error of
php?
thanks
Zeppelin wrote:
Hi,
I have to port from asp a script that adds an ip to a list in plain
text or an array. I need not using a database or filesystem, it has to
be stored in memory in order that giving us best performance (it should
be accessed continuously).
Hi,
The easiest way is just including a file at top of your scripts.
Into that file you define some constants or variables.
I''ve tried defining
_ENV vars, using apache_setenv(..), creating a
class with a static var... but nothing results.
Don''t.
:-)
Just include a file.
In asp the script writes an reads an Application variable defined in
global.asa... is it impossible to port? isn''t it a very big error of
php?
No, this isn''t a big error.
If you worry about performance, don''t.
Files that are accessed a lot of time will be placed in cache (memory) if
possible by the OS.
Thus no performancepenalty.
On a sidenote: I don''t understand why so many people worry about performance
when they do not have a performanceproblem.
My guess is that over 90% of all performanceproblems are databaserelated
(bad queries, no indexing, etc) and not scriptinglanguage related.
If you absolutely want to use shared memory in PHP, that is possible.
I do n''t remember the name of the package, but if you look around I am sure
you will find it.
My advise is however: Just include a file.
Regards,
Erwin Moller
thanks
这篇关于Mantain是一个变量,通过几个脚本,如asp中的global.asa变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!