mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
注释改进 增加Json配置驱动
This commit is contained in:
@@ -177,7 +177,11 @@ class Config
|
||||
*/
|
||||
public static function reset($range = '')
|
||||
{
|
||||
$range = $range ?: self::$range;
|
||||
true === $range ? self::$config = [] : self::$config[$range] = [];
|
||||
$range = $range ?: self::$range;
|
||||
if (true === $range) {
|
||||
self::$config = [];
|
||||
} else {
|
||||
self::$config[$range] = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
24
library/think/config/driver/Json.php
Normal file
24
library/think/config/driver/Json.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2016 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace think\config\driver;
|
||||
|
||||
class Json
|
||||
{
|
||||
public function parse($config)
|
||||
{
|
||||
if (is_file($config)) {
|
||||
$config = file_get_contents($config);
|
||||
}
|
||||
$result = json_decode($config, true);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ namespace think\db;
|
||||
|
||||
use PDO;
|
||||
use think\Db;
|
||||
use think\db\Connection;
|
||||
use think\db\Query;
|
||||
use think\Exception;
|
||||
|
||||
abstract class Builder
|
||||
@@ -38,9 +40,9 @@ abstract class Builder
|
||||
/**
|
||||
* 架构函数
|
||||
* @access public
|
||||
* @param \think\db\Connection $connection 数据库连接对象实例
|
||||
* @param Connection $connection 数据库连接对象实例
|
||||
*/
|
||||
public function __construct($connection)
|
||||
public function __construct(Connection $connection)
|
||||
{
|
||||
$this->connection = $connection;
|
||||
}
|
||||
@@ -48,10 +50,10 @@ abstract class Builder
|
||||
/**
|
||||
* 设置当前的Query对象实例
|
||||
* @access protected
|
||||
* @param \think\db\Query $query 当前查询对象实例
|
||||
* @param Query $query 当前查询对象实例
|
||||
* @return void
|
||||
*/
|
||||
public function setQuery($query)
|
||||
public function setQuery(Query $query)
|
||||
{
|
||||
$this->query = $query;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ use PDO;
|
||||
use PDOStatement;
|
||||
use think\Collection;
|
||||
use think\Db;
|
||||
use think\db\Query;
|
||||
use think\Debug;
|
||||
use think\Exception;
|
||||
use think\exception\DbBindParamException;
|
||||
@@ -128,7 +129,7 @@ abstract class Connection
|
||||
* 创建指定模型的查询对象
|
||||
* @access public
|
||||
* @param string $model 模型类名称
|
||||
* @return \think\db\Query
|
||||
* @return Query
|
||||
*/
|
||||
public function model($model)
|
||||
{
|
||||
|
||||
@@ -45,9 +45,9 @@ class Relation
|
||||
/**
|
||||
* 架构函数
|
||||
* @access public
|
||||
* @param \think\Model $model 上级模型对象
|
||||
* @param Model $model 上级模型对象
|
||||
*/
|
||||
public function __construct($model)
|
||||
public function __construct(Model $model)
|
||||
{
|
||||
$this->parent = $model;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user