首页 »PHP教程 » php入门:PHP大型Web应用入门( 9) »正文
php入门:PHP大型Web应用入门( 9)
来源: 发布时间:星期一, 2009年1月12日 浏览:28次 评论:0
functionparse($file) { global$page_time,$page_time_start; $tplfile=$this->tpl_dir.$file.'.'.$this->tpl_file_ext; $objfile=$this->tpl_cache_root_dir.'/'.$this->tpl_name.'_'.$file.'.tpl.'.$this->tpl_cache_file_ext; (!file_exists($tplfile)){ $tplfile=$this->tpl_root_dir.'/'.$this->default_tpl_name.'/'.$file.'.'.$this->tpl_file_ext; $objfile=$this->tpl_cache_root_dir.'/'.$this->default_tpl_name.'_'.$file.'.tpl.'.$this->tpl_cache_file_ext; } ((@filemtime($tplfile)>@filemtime($objfile))||(!@file_exists($objfile))){ //$this->parse_template($tplfile,$objfile); (!@$fp=fopen($objfile,'w')){ die("Directory'".$this->tpl_root.'/'.$this->tpl_cache_root."'notfoundorhavenoaccess!"); } flock($fp,3); fwrite($fp,$this->parse_template($tplfile,$objfile)); fclose($fp); } list($usec,$sec)=explode("",microtime); $page_time_end=$usec+$sec; $page_time=sprf("%0.6f",$page_time_end-$page_time_start); $objfile; } function_tpl_db_handle($dh) { $this->defalt_db_handle='$'.$dh; } function_tpl_name($name) { $tpl_dir=$this->tpl_root_dir.'/'.$name.'/'; ($name!=''&&is_dir($tpl_dir)){ $this->tpl_name=$name; $this->tpl_dir=str_replace('//','/',$tpl_dir); } { $this->tpl_name=$this->default_tpl_name; $this->tpl_dir=str_replace('//','/',$this->tpl_root_dir.'/'.$this->tpl_name.'/'); } } function_language($langMeta) { $langFile=$this->tpl_dir.$langMeta.'.lang'; clearstatcache; (@is_readable($langFile)){ $langFile; } (@is_readable($this->tpl_dir.$this->default_lang.'.'.$this->tpl_lang_file_ext)){ $langFile=$this->tpl_dir.$this->default_lang.'.'.$this->tpl_lang_file_ext; $langMeta=$this->default_lang; $langFile; } (@is_readable($this->tpl_root_dir.'/'.$this->default_tpl_name.'/'.$langMeta.'.lang')){ $langFile=$this->tpl_root_dir.'/'.$this->default_tpl_name.'/'.$langMeta.'.lang'; $langFile; } (@is_readable($this->tpl_root_dir.'/'.$this->default_tpl_name.'/'.$this->default_lang.'.'.$this->tpl_lang_file_ext)){ $langFile=$this->tpl_root_dir.'/'.$this->default_tpl_name.'/'.$this->default_lang.'.'.$this->tpl_lang_file_ext; $langMeta=$this->default_lang; $langFile; }
die('AcceptLangfile:'.$langFile.'didnotexistorhasnoaccess!'); } functiondsp { global$mSession; ($mSession['do_gzip']){ $gzip_contents=ob_get_contents; ob_end_clean; $gzip_size=strlen($gzip_contents); $gzip_crc=crc32($gzip_contents); $gzip_contents=gzcompress($gzip_contents,9); $gzip_contents=substr($gzip_contents,0,strlen($gzip_contents)-4); echo"x1fx8bx08x00x00x00x00x00"; echo$gzip_contents; echopack('V',$gzip_crc); echopack('V',$gzip_size); }
ob_end_flush; } functionget__html($file) { //JustforTest... $_file='../../data//'.$file.'.'.$this->tpl__file_ext; (@$fp=fopen($_file,'wb')){ fwrite($fp,ob_get_contents); fclose($fp); } ob_end_clean; ; } } functionaddquote($var) { str_replace(""",""",preg_replace("/[([a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*)]/s","['1']",$var)); } functionstripvtags($expr,$statement) { $expr=str_replace(""",""",preg_replace("/<?=($[a-zA-Z_x7f-xff][a-zA-Z0-9_"'x7f-xff]*)?>/s","1",$expr)); $statement=str_replace(""",""",$statement); $expr.$statement; } ?>
后面附了 个简单 获取静态页 思路方法 其实也没什么用 大家都有更好 思路方法来生成静态页
相关文章
读者评论
发表评论
|
|