结合Smarty,生成HTML静态页

/**
     * 生成HTML静态页
     */
    public function createHtml($pagePath)
    {
        ob_end_clean();                        //清空缓冲区
        ob_start();                            //开启缓冲区
        
        $this->smarty->display($pagePath);
        $data = ob_get_contents();            
        ob_end_clean();                        //清空缓冲区
        
        $file = str_replace("controllers", "", dirname(__FILE__)) . "html/aaa.html";
        $strlen = file_put_contents($file, $data);
        @chmod($file, 0777);
        echo $data;
    }

 

posted @ 2013-05-20 16:25  王翔(kingfly)  阅读(803)  评论(0编辑  收藏  举报