自用模板引擎。
PHP代码
去日租程序是一款具有强大的功能的基于.NET+SQL2000+AJAX构架的房屋出租管理系统。 日租网站管理系统,采用ASP.NET2.0语言开发,它集成租房模块、文章模块、订单模块、邮箱短信模块、用户模板、SEO优化模块、房间模块、支付模块等多项强大功能。系统有多年经验的高级工程师采用三层架构开发,页面代码全部采用DIV+CSS,完全符合SEO标准,有利于搜索引擎关键排名优化。日租网站
0
<?php
define('APP_PATH', __DIR__);
class Template{
private static $_vars;
private static $_path;
private static $_prefix;
private function __construct() {}
public static function init($path = null) {
if(isset($path)&&($path!='')) self::$_path=APP_PATH.'/templates/'.$path.'/';
else self::$_path = APP_PATH.'/templates/';
self::$_vars = array();
}
public static function set_path($path) {
self::$_path = $path;
}
public static function set_prefix($prefix) {
self::$_prefix = $prefix;
}
public static function assign($key, $value = null)
{ if(!isset(self::$_vars)) self::init();
if (is_array($key)) self::$_vars = array_merge(self::$_vars,$key);
elseif (($key != '')&&(isset($value)))
self::$_vars[$key] = $value;
}
public static function fetch($file) {
if(!isset(self::$_vars)) self::init();
if(count(self::$_vars)>0)
{ extract(self::$_vars,EXTR_PREFIX_ALL,self::$_prefix);
self::$_vars = array();
}
ob_start();
include self::$_path . $file ;
$contents = ob_get_contents();
ob_end_clean();
self::$_path = null;
return preg_replace('!\s+!', ' ', $contents);
}
}
?>
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号