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麻豆精品国产自产在线观看 | 国产成人精品cao在线 | 国语对白一区二区三区 | 日本不卡一区二区三区视频 | 欧美色资源 | 日韩一级片网址 | 大色虫成人午夜在线观看 | 美国人和狍xxxx视频 | 91日韩在线 | 亚洲精品人成网在线播放影院 | 日韩a无吗一区二区三区 | 国产成人精视频在线观看免费 | 精品福利视频一区二区三区 | 在线播放国产视频 | 国产精品久久一区一区 | 亚洲国产99在线精品一区二区 | 国产成人精品福利网站在线观看 | 天天在线天天综合网色 | 91精品视频免费 | 日韩美女一区二区三区 | 人人做天天爱夜夜爽中字 | 久久久久久久91精品免费观看 | www.日本高清 | 激情五月五月婷婷 | 久久国产免费一区二区三区 | 国产亚洲玖玖玖在线观看 | 综合区小说区图片区在线一区 | 99热精品成人免费观看 | 午夜精品国产 | 手机看片www xiao2b cm | 国产乱码在线观看 | 好吊操这里只有精品 | 91丝袜美腿高跟国产极品老师 | 91午夜精品午夜剧场 | 亚洲精品久 | 顶级欧美色妇xxxxx | 九九久久精品国产 |