/**
* Render a system default template, which is essentially a PHP template.
*
* @param $template_file
* The filename of the template to render. Note that this will overwrite
* anything stored in $variables['template_file'] if using a preprocess hook.
* @param $variables
* A keyed array of variables that will appear in the output.
*
* @return
* The output generated by the template.
*/
function theme_render_template($template_file, $variables) {
extract($variables, EXTR_SKIP); // Extract the variables to a local namespace
ob_start(); // Start output buffering
include "./$template_file"; // Include the template file
$contents = ob_get_contents(); // Get the contents of the buffer
ob_end_clean(); // End buffering and discard
return $contents; // Return the contents
}drupal框架中使用的渲染模版的方法 方便前端和逻辑代码分开,一次请求过程可多次调用
最后
以上就是默默高山最近收集整理的关于php渲染怎么写,PHP渲染模版的的方法的全部内容,更多相关php渲染怎么写,PHP渲染模版内容请搜索靠谱客的其他文章。
发表评论 取消回复