feat: 同步下新环境
This commit is contained in:
@@ -13,19 +13,12 @@ namespace think\config\driver;
|
||||
|
||||
class Ini
|
||||
{
|
||||
protected $config;
|
||||
|
||||
public function __construct($config)
|
||||
public function parse($config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function parse()
|
||||
{
|
||||
if (is_file($this->config)) {
|
||||
return parse_ini_file($this->config, true);
|
||||
if (is_file($config)) {
|
||||
return parse_ini_file($config, true);
|
||||
} else {
|
||||
return parse_ini_string($this->config, true);
|
||||
return parse_ini_string($config, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,19 +13,12 @@ namespace think\config\driver;
|
||||
|
||||
class Json
|
||||
{
|
||||
protected $config;
|
||||
|
||||
public function __construct($config)
|
||||
public function parse($config)
|
||||
{
|
||||
if (is_file($config)) {
|
||||
$config = file_get_contents($config);
|
||||
}
|
||||
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function parse()
|
||||
{
|
||||
return json_decode($this->config, true);
|
||||
$result = json_decode($config, true);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,28 +13,19 @@ namespace think\config\driver;
|
||||
|
||||
class Xml
|
||||
{
|
||||
protected $config;
|
||||
|
||||
public function __construct($config)
|
||||
public function parse($config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function parse()
|
||||
{
|
||||
if (is_file($this->config)) {
|
||||
$content = simplexml_load_file($this->config);
|
||||
if (is_file($config)) {
|
||||
$content = simplexml_load_file($config);
|
||||
} else {
|
||||
$content = simplexml_load_string($this->config);
|
||||
$content = simplexml_load_string($config);
|
||||
}
|
||||
|
||||
$result = (array) $content;
|
||||
foreach ($result as $key => $val) {
|
||||
if (is_object($val)) {
|
||||
$result[$key] = (array) $val;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user