php生成页面的问题 满意再+50

来源:百度知道 编辑:UC知道 时间:2024/09/28 08:04:21
<?php
class lly_template{
var $template_file_name;
var $content;
function lly_template($filename = "template.html"){
$this -> template_file_name = $filename;
}
function load(){
$fs = fopen($this -> template_file_name,"r");//这里打开$this -> template_file_name也就是相当打template.html页面一样.因为上面$filename等于 template.html,现在$filename又等于$this -> ....
$content_ = fread($fs, filesize($this -> template_file_name));
fclose($fs);
$this -> content = $content_;
}
function repl($html_rep, $php_rep){
$this -> content = ereg_replace("\{".$html_rep."\}",$php_rep,$this -> content);
}
}
?>能帮我解译一下吗?就是一段一段的注译谢谢.如果我满意再加分

<?php
class lly_template{ //类 lly_template
var $template_file_name; //申明 类变量$template_file_name
var $content; //申明 类变量$content

//函数 lly_template 里面的 参数 $filename 赋值 "template.html"
function lly_template($filename = "template.html" ){
$this -> template_file_name = $filename; //赋值 给变量 类 变量 $template_file_name 等于 $template_file_name="template.html";
}

//函数 load
function load(){
$fs = fopen($this -> template_file_name,"r"); // 打开目录下的 template.html 文件
$content_ = fread($fs, filesize($this -> template_file_name)); //然后读取 template.html文件里面的内容,把内容 赋值给 变量 $content
fclose($fs); //关闭 文件
$this -> content = $content_; //把变量$content_ 赋给 类的 变量 $content
}
//函数 repl;
function repl($html_rep, $php_rep){
$this -> content = ereg_replace("\{".$html_rep."\}",$p