mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-02 05:02:48 +08:00
类型转换增加array类型 自动进行json编码和解码
This commit is contained in:
@@ -173,6 +173,11 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
case 'boolean':
|
||||
$value = (bool) $value;
|
||||
break;
|
||||
case 'array':
|
||||
if (is_array($value)) {
|
||||
$value = json_encode($value, JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -207,6 +212,9 @@ abstract class Model implements \JsonSerializable, \ArrayAccess
|
||||
case 'boolean':
|
||||
$value = (bool) $value;
|
||||
break;
|
||||
case 'array':
|
||||
$value = json_decode($value, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user