开发者

best way to store a variable available to every session in php

开发者 https://www.devze.com 2022-12-15 06:03 出处:网络
I wanted to know what would be a good way for storing the information required by a something like a hit counter. I was wondering if this was possible using some session-like technique, but avail开发者

I wanted to know what would be a good way for storing the information required by a something like a hit counter. I was wondering if this was possible using some session-like technique, but avail开发者_运维问答able to everyone. I am concerned about speed/performance, and not memory usage since the data to be store is minimal.


This is the sort of thing people use APC and/or memcached for.


Store it in a database!

If you app doesnt already use a DB you almost certainly have sqlite installed as part of your php installtion. Its about 10 lines of code to connect and read the value.

If you app already uses a db its one extra table with one extra column.

0

精彩评论

暂无评论...
验证码 换一张
取 消