【发布时间】:2011-11-08 02:58:40
【问题描述】:
哪个更好,为什么?有人可以向我解释一下吗?非常感谢。
//Example 1
if($var == 1)
{
echo "text text text..."; //Note: large text like 1MB
}
或
//Example 2
if($var == 1)
{
echo file_get_contents("path/to/file"); //content of this file same as echo text above
}
【问题讨论】:
-
如果没有详细的上下文,这个问题毫无意义。最有效的方法是直接由 apache 提供文件。而且,是的,您可以使用 apache
ab工具自己比较性能 -
第 2 步。它将数据与代码分离。
-
@Jitamaro:别这么绝对!
-
@zerkms:我是分层的,它更像是一个命令。与盒子无关。
标签: php performance apache