【www.gdgbn.com--php入门】

function GetContent($type){
  if( $type )
  {
   if(file_exists("./mail_room.html") )
   {
    $content = file_get_contents( "./mail_room.html");
   }
   else
   {
    ShowMsg("file can" read fail ");
   }
  }
  else
  {
   if( file_exists( "./mail_person.html") )
   {
    $content = file_get_contents( "./mail_person.html");
   }
   else
   {
    ShowMsg("person file read fail!");
   }
   
  }
  return $content;
 }
 
 function template($str)
 {
  $_url = $_SERVER["HTTP_HOST"];
  $_temp = str_replace("{username}",$_SESSION["uname"],$str);
  $_temp = str_replace("[bgpic]",getPic(),$_temp);
  $_temp = str_replace("{url}",$_url,$_temp);
  return $_temp;
 }

我们来看看模板文件





   
   
     
         
             


  •                

  •                

  •            
           
         
             
               
               
                 新潮食物与儿童疾病的关系
                    不宜喂养宝宝的24种食物 
                    育儿饮食错误观点大罗列
               
           
           
           

    {username}说:


           

    我发现明星宝宝啦,
            快来一起合影吧!


           
         
       

    本文来源:http://www.gdgbn.com/jiaocheng/20407/