脚本宝典收集整理的这篇文章主要介绍了PHP的file_get_contents与php完好无损?,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我的目标看起来像:
$template = some_imaginary_include_function('myfile.PHP'); foreach($list_of_blogs as $bLOG) { // somehow get blog content in template and render template; }
我知道那是一个愚蠢的例子……但我希望它能说明一般的想法.如果我必须在页面上循环模板50次(比如它是一个博客列表),实际运行并包含每个模板似乎都很愚蠢.
function getTemplate($file) { ob_start(); // start output buffer include $file; $template = ob_get_contents(); // get contents of buffer ob_end_clean(); return $template; }
以上是脚本宝典为你收集整理的PHP的file_get_contents与php完好无损?全部内容,希望文章能够帮你解决PHP的file_get_contents与php完好无损?所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。