English 中文(简体)
我如何在PHP的应用范围内节省数据?
原标题:How do I save data in an application scope in PHP?

I m a Java and C# developer,而且我承认,I m在PHP中不是这样。

我需要在申请范围内储存一物体,只要该物体本身运行。 我可以节省会议费用,因为会议结束,我也可以把会议编成光盘。

是否有像C# Application的物体列入PHP?

最佳回答

<>strong>2018 Edit: 时间为而不是 ,特别是因为PHP 7包含对Zentd Bestizer+的捆绑支持,后者基本上相同(除了关键仓库之外)。 几天后,主要储存部分被推到装甲运兵车项目

然而,在2018年,首选的主要选择是。 见ext-redis Project


PHP有各种应用范围。 它称作 (Alternative PHP Cache)

如果符合以下标准,应当将数据贴上装甲运兵车:

  1. It is not user session-specific (if so, put in $_SESSION[])
  2. It is not really long-term (if so, use the file system)
  3. It is only needed on one PHP server (if not, consider using memcached)
  4. You want it available to every page of your site, instantly, even other (non-associated) PHP programs.
  5. You do not mind that all the data stored in it is lost on Apache reload/restart.
  6. You want data access far faster than file-based, memcached, or (esp.) database-based.

技转中心已在许多东道国安装,但遵循上述指南,安装在你的箱子上。 那么,你就是这样做的:

if (apc_exists( app:app_level_data ) !== false)
{
    $data = apc_fetch( app:app_level_data );
}
else
{
    $data = getFromDB( foo );
    apc_store( app:app_level_data , $data);
}
问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签