如何将数据存储在内存中,以便PHP脚本可以像$ _SESSION一样访问它?

I have few scripts that must share highly dynamic data that is accessible on every HTTP request, just like $_SESSION for user's session. What is the best way to achieve that?

You may try APC or Memcache.

If you are not able to use any of those, a MySQL table with memory engine might be also the answer.

Take a look into in-memory storages, like memcached (PHP extension), Redis or MySQL's MEMORY tables. Also, there are a lot of other storage engines that uses RAM to store data.

You could also simply store your data in a tmpfs. This link http://we-love-php.blogspot.de/2013/02/php-caching-shm-apc-memcache-mysql-file-cache.html has a nice performance comparison.