mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 23:52:49 +08:00
Think\parser类 改进
This commit is contained in:
@@ -14,11 +14,15 @@ namespace Think;
|
|||||||
// 内容解析类
|
// 内容解析类
|
||||||
class Parser {
|
class Parser {
|
||||||
|
|
||||||
|
static private $handler = [];
|
||||||
|
|
||||||
// 解析内容
|
// 解析内容
|
||||||
static public function parse($content,$type){
|
static public function parse($content,$type){
|
||||||
|
if(!isset(self::$handler[$type])) {
|
||||||
$class = '\\Think\\Parser\\Driver\\'.ucwords($type);
|
$class = '\\Think\\Parser\\Driver\\'.ucwords($type);
|
||||||
$parse = new $class();
|
self::$handler[$type] = new $class();
|
||||||
return $parse->parse($content);
|
}
|
||||||
|
return self::$handler[$type]->parse($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 调用驱动类的方法
|
// 调用驱动类的方法
|
||||||
|
|||||||
Reference in New Issue
Block a user