【发布时间】:2014-10-07 20:17:04
【问题描述】:
这两种获取文件内容的方式有什么区别?哪一个更好更高效?我认为他们都获得了相同的结果,但我真的不知道哪种方法更好。
例如。
此代码使用输出缓冲来获取文件的内容:
ob_start();
include('foo/bar.tpl');
$output .= ob_get_contents();
ob_end_clean();
此代码使用 file_get_contents 并获得相同的结果。
$output = file_get_contents('foo/bar.tpl');
【问题讨论】:
标签: php templates file-get-contents output-buffering