Pain.php 復制代碼 代碼如下: <?php class Pain { public $var=array(); public $tpl=array(); //this is the method to assign vars to the template public function assign($variable,$value=null) { $ " /> 国产成人永久在线播放,欧美日韩国产超高清免费看片,欧美一级爽快片淫片高清在线观看

一区二区久久-一区二区三区www-一区二区三区久久-一区二区三区久久精品-麻豆国产一区二区在线观看-麻豆国产视频

Pain 全世界最小最簡單的PHP模板引擎 (普通版)

打包下載

Pain.php
復制代碼 代碼如下:
<?php
class Pain
{
public $var=array();
public $tpl=array();
//this is the method to assign vars to the template
public function assign($variable,$value=null)
{
$this->var[$variable]=$value;
}
public function display($template_name,$return_string=false)
{
//first find whether the tmp file in tmp dir exists.
if(file_exists("tmp/temp_file.php"))
{
unlink("tmp/temp_file.php");
}
extract($this->var);
$tpl_content=file_get_contents($template_name);
$tpl_content=str_replace("{@", "<?php echo ", $tpl_content);
$tpl_content=str_replace("@}", " ?>", $tpl_content);
//create a file in the /tmp dir and put the $tpl_contentn into it, then
//use 'include' method to load it!
$tmp_file_name="temp_file.php";
//$tmp is the handler
$tmp=fopen("tmp/".$tmp_file_name, "w");
fwrite($tmp, $tpl_content);
include "tmp/".$tmp_file_name;
}
}
?>

test.php
復制代碼 代碼如下:
<?php
require_once "Pain.php";
$pain=new Pain();
$songyu="songyu nb";
$zhangyuan="zhangyuan sb";
$pain->assign("songyu",$songyu);
$pain->assign("zhangyuan",$zhangyuan);
$pain->display("new_file.html");
?>

new_file.html
復制代碼 代碼如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>new_file</title>
</head>
<body>
{@$songyu@}<br/>
{@$zhangyuan@}
</body>
</html>

php技術Pain 全世界最小最簡單的PHP模板引擎 (普通版),轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 精品视频一区二区三区在线播放 | 在线观看91精品国产剧情免费 | 国产成人午夜极速观看 | 久久精品91 | 国产成人国产在线观看入口 | 中文字幕不卡一区 二区三区 | 真实国产乱子伦精品一区二区三区 | xxx日本在线| 伊人天伊人天天网综合视频 | 国内精品久久久久影院不卡 | 加勒比精品 | 国产精品一区二区三区高清在线 | 婷婷丁香视频 | 人人狠狠综合久久亚洲婷婷 | 色播亚洲精品网站 亚洲第一 | 在线观看黄色 | 91视频国产精品 | 亚洲综合色就色手机在线观看 | 国产福利在线免费观看 | 韩国三日本三级中文字幕 | 四虎影视久久久 | 亚洲精品国产自在久久老牛 | 国产精品欧美日韩视频一区 | 国产成人影院一区二区 | 天天做天天爱天天爽天天综合 | 全色黄大色大片免费久久老太 | 亚洲一区二区中文 | 亚洲一区二区三区不卡视频 | 两性色 | 在线色网址| 欧美亚洲国产精品久久久久 | 亚洲国产天堂久久综合 | 亚洲欧美日韩精品在线 | 久久久精彩视频 | 欧美激情视频在线免费观看 | 五月婷婷色 | 999精品免费视频 | 国产日韩欧美精品一区二区三区 | 狠狠干狠狠干狠狠干 | 国产成人亚洲综合小说区 | 亚洲妇人成熟性成熟网站 |