search
Homephp教程php手册网友原创的PHP模板类

网友原创的PHP模板类

<table style="BORDER-RIGHT: #cccccc 1px dotted; TABLE-LAYOUT: fixed; BORDER-TOP: #cccccc 1px dotted; BORDER-LEFT: #cccccc 1px dotted; BORDER-BOTTOM: #cccccc 1px dotted" cellspacing="0" cellpadding="6" width="95%" align="center" border="0"> <tr> <td style="WORD-WRAP: break-word" bgcolor="#f3f3f3"> <font style="FONT-WEIGHT: bold; COLOR: #990000">以下是PHP源代码:</font><br><?php <br/>    class Lightpage_Template { <br>     <br>        var $Tpl_Header; <br>        var $Tpl_Footer; <br>        var $Tpl_Parsing; <br>        var $Tpl_Template; <br>        var $Tpl_Dirname; <br>         <br>        var $Tpl_Parse_String; <br>        var $Tpl_Parse_Array; <br>         <br>        var $Tpl_Result; <br>         <br>        function __construct() { <br>            $this->Tpl_Header = NULL; <br>            $this->Tpl_Footer = NULL; <br>            $this->Tpl_Parsing = array(); <br>            $this->Tpl_Template = ’list.html’; <br>            $this->Tpl_ToParse = NULL; <br>             <br>            $this->Tpl_Parse_String = array(); <br>            $this->Tpl_Parse_Array = array(); <br>             <br>            $this->Tpl_Result = NULL; <br>            return true; <br>        } <br>         <br>        function Parse_Template() { <br>            $this->Tpl_Parse_String = array(); <br>            $this->Tpl_Parse_Array = array(); <br>            if($this->Tpl_Header!=NULL) { array_push($this->Tpl_Parse_String,$this->Tpl_Header);array_push($this->Tpl_Parse_Array,’{header}’); } <br>            if($this->Tpl_Footer!=NULL) { array_push($this->Tpl_Parse_String,$this->Tpl_Footer);array_push($this->Tpl_Parse_Array,’{footer}’); } <br>            if(count($this->Tpl_Parsing)!=1) { <br>                foreach($this->Tpl_Parsing as $Tpl_Key => $Tpl_Value) { <br>                    array_push($this->Tpl_Parse_String,$Tpl_Value); <br>                    array_push($this->Tpl_Parse_Array,’{’.$Tpl_Key.’}’); <br>                } <br>            } <br>            if($this->Tpl_Template!=NULL && $this->Tpl_ToParse==NULL) { <br>                $this->Tpl_ToParse = file_get_contents(root.’./Templates/’.$this->Tpl_Template); <br>            }  <br>            $this->Tpl_Result = str_replace($this->Tpl_Parse_Array,$this->Tpl_Parse_String,$this->Tpl_ToParse); <br>            return $this->Tpl_Result; <br>        } <br>     <br>    } <br>?>  <br><br>用法: <br><br><br>$Mdl = new Lightpage_Template(); <br>    $Mdl->Tpl_Header = ’zzz’; <br>    $Mdl->Tpl_Footer = ’’; <br>    $Mdl->Tpl_Parsing = ’’; <br>    $Mdl->Tpl_Template = ’list.html’; <br>    echo $Mdl->Parse_Template(); </td> </tr> </table>



Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft