mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-02 21:52:34 +08:00
改进Model类的JSON类型转换 支持非数组类型
This commit is contained in:
@@ -321,11 +321,12 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
$value = json_encode($value, JSON_FORCE_OBJECT);
|
||||
}
|
||||
break;
|
||||
case 'json':
|
||||
|
||||
case 'array':
|
||||
if (is_array($value)) {
|
||||
$value = json_encode($value, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
$value = (array) $value;
|
||||
case 'json':
|
||||
$value = json_encode($value, JSON_UNESCAPED_UNICODE);
|
||||
|
||||
break;
|
||||
}
|
||||
return $value;
|
||||
|
||||
Reference in New Issue
Block a user