if (!empty($this->relationWrite)) {
$this->autoRelationUpdate();
return true;
if ($this->autoWriteTimestamp && $this->updateTime) {
// 自动写入更新时间
$data[$this->updateTime
= $this->autoWriteTimestamp();
$this->data[$this->updateTime
= $data[$this->updateTime
;
// 检查允许字段
$allowFields = $this->checkAllowFields();
跟进checkAllowFields方法 , 漏洞方法是db , 默认也是会触发该方法 , 继续跟进 。
protected function checkAllowFields(): array
{
// 检测字段
if (empty($this->field)) {
if (!empty($this->schema)) {
$this->field = array_keys(array_merge($this->schema $this->jsonType));
else {
$query = $this->db();
跟进db方法 , 存在$this->table . $this->suffix字符串拼接 , 可以触发__toString魔术方法 , 把$this->table设为触发__toString类即可 。
public function db($scope = [
): Query
{
/** @var Query $query */
$query = self::$db->connect($this->connection)
->name($this->name . $this->suffix)
->pk($this->pk);
if (!empty($this->table)) {
$query->table($this->table . $this->suffix);
全局搜索__toString方法 , 最后选择vendor\\topthink\\think-orm\\src\\model\\concern\\Conversion.php类中的__toString方法 。
跟进__toString方法 , 调用了toJson方法 。
跟进toJson方法 , 调用了toArray方法 , 然后以JSON格式返回 。
跟进toArray方法漏洞方法是getAtrr默认就会触发 , 只需把$data设为数组就行 。
public function toArray(): array
{
$item = [
;
$hasVisible = false;
foreach ($this->visible as $key => $val) {
if (is_string($val)) {
if (strpos($val '.')) {
[$relation $name
= explode('.' $val);
$this->visible[$relation
[
= $name;
else {
$this->visible[$val
= true;
$hasVisible = true;
unset($this->visible[$key
);
- 小米|小米最强影像旗舰!小米12S系列海报泄密:徕卡标变白了
- 陨石|小行星“打水漂”闯入地球 形成世界最长陨石陨落带
- 个头大的车厘子比小樱桃营养价值更高,对吗 蚂蚁新村6月28日答案最新
- ssd|小屏旗舰跌至2699元,67W快充+5000万三摄,成荣耀70最大对手
- 最前线 | 腾讯游戏发布40余款产品与项目,《王者荣耀》发布全新规划
- “大家好,我是渣渣辉!”,最近刷爆朋友圈的港普大家来了解一下
- 最小4毫米!一种名叫“老佛爷”的蜘蛛来了,灭绝生物会出现吗?
- 显卡|3个不买RTX 3080的理由:没钱只能排最后
- 世界最干旱沙漠传来消息,长出18亿棵树,科学家:令人担忧
- 高通骁龙|夏天一到骁龙8Gen1没怎么玩就发热?Find X5 Pro用户最有发言权
