写入数据为对象的时候检测是否有__toString方法

This commit is contained in:
thinkphp
2016-12-23 10:23:54 +08:00
parent 35d2c6552c
commit a996640c7e

View File

@@ -118,6 +118,9 @@ abstract class Builder
$this->query->bind($key, $val, isset($bind[$key]) ? $bind[$key] : PDO::PARAM_STR);
$result[$item] = ':' . $key;
}
} elseif (is_object($val) && method_exists($val, '__toString')) {
// 对象数据写入
$result[$item] = $val->__toString();
}
}
return $result;