thinkphp/library/think/model/Merge.php
(开头部分) 11KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +----------------------------------------------------------------------
namespace think\model;
use think\Db;
use think\db\Query;
use think\Model;
class Merge extends Model
{
protected $relationModel = []; // HAS ONE 关联的模型列表
protected $fk = ''; // 外键名 默认为主表名_id
protected $mapFields = []; // 需要处理的模型映射字段,避免混淆 array( id => 'user.id' )
/**
* 构造函数
* @access public
* @param array|object $data 数据
*/
public function __construct($data = [])
{
parent::__construct($data);
// 设置默认外键名 仅支持单一外键
if (empty($this->fk)) {
$this->fk = strtolower($this->name) . '_id';
}
}
/**
* 查找单条记录
* @access public
* @param mixed $data 主键值或者查询条件(闭包)
* @param string|array $with 关联预查询
* @param bool $cache 是否缓存
* @return \think\Model
*/
public static function get($data = null, $with = [], $cache = false)
{
$query = self::parseQuery($data, $with, $cache);
$query = self::attachQuery($query);
return $query->find($data);
}
/**
* 附加查询表达式
* @access protected
* @param \think\db\Query $query 查询对象
* @return \think\db\Query
*/
后面还有 262 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
