比如数据库中age为int类型,查出的$arr=['age'=>20,'id'=>100];通过Response::json($arr)
返回的json为{"id":100,"age":20}
,除了在model中设置$casts=['age'=>'string']
类型转换还有什么办法转换为{"id":"100","age":"20"}
?因为要设置的字段太多
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
json_dump