增加配置文件驱动接口,以便用户在遵循接口的前提下定义并使用自己的驱动,例如 YAML

This commit is contained in:
dongww
2015-12-16 18:36:01 +08:00
parent c3d1b63635
commit 093023cf13
4 changed files with 46 additions and 8 deletions

View File

@@ -0,0 +1,29 @@
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2015 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: dongww <dongww@gmail.com>
// +----------------------------------------------------------------------
namespace think\config\driver;
/**
* 配置文件解析驱动接口
*
* @package think\config\driver
*/
interface DriverInterface
{
/**
* 解析配置文件或内容,并以字符串形式返回
*
* @param string $config 配置文件路径或字符串
*
* @return array 以数组形式返回配置
*/
public function parse($config);
}

View File

@@ -11,7 +11,7 @@
namespace think\config\driver;
class Ini
class Ini implements DriverInterface
{
public function parse($config)
{

View File

@@ -11,7 +11,7 @@
namespace think\config\driver;
class Xml
class Xml implements DriverInterface
{
public function parse($config)
{