Home >Backend Development >PHP Tutorial >Eloquent ORM 怎么设置查询结果数据类型是按MYSQL的字段类型返回

Eloquent ORM 怎么设置查询结果数据类型是按MYSQL的字段类型返回

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 20:20:271513browse

在MYSQL里面设置的INT,smallint,tinyint等字段,查询出来都变成字符串了,唯独主键没有变成字符串。
请教怎么设置?

回复内容:

在MYSQL里面设置的INT,smallint,tinyint等字段,查询出来都变成字符串了,唯独主键没有变成字符串。
请教怎么设置?

用Attribute Casting

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn