diff --git a/Think/ConfigParser.php b/Think/ConfigParser.php new file mode 100644 index 00000000..e2f3ad44 --- /dev/null +++ b/Think/ConfigParser.php @@ -0,0 +1,26 @@ + +// +---------------------------------------------------------------------- +// $Id$ + +namespace Think; +// 配置文件解析类 解析成php数组 +class ConfigParser { + public function __construct($content,$type){ + $class = '\Think\ConfigParser\Driver\\'.ucwords($type); + $parse = new $class(); + return $parse->parse($content); + } + + // 解析内容 + static public function parse($content,$type){ + return new static($content,$type); + } +} \ No newline at end of file diff --git a/Think/Parser.php b/Think/Parser.php index 938a79d9..09554a76 100644 --- a/Think/Parser.php +++ b/Think/Parser.php @@ -13,7 +13,7 @@ namespace Think; // 内容解析类 class Parser { - protected $handler = null; + public function __construct($content,$type){ $class = '\Think\Parser\Driver\\'.ucwords($type); $parse = new $class();