Array
(
[contentID] => 9
[0] => 9
[type] => operations
[1] => operations
[type_alts] => pages
[2] => pages
[url] => ctt-partners
[3] => ctt-partners
[title] => CTT Partners
[4] => CTT Partners
[subtitle] =>
[5] =>
[online] => 1
[6] => 1
[access] => 0
[7] => 0
[req] => 0
[8] => 0
)
我在数组之后没有返回相同的整数字段以及名称.例如[0] => 9,[1] =>操作.我也不想要这些.
他们为什么在这里,我怎么能摆脱他们.
谢谢,
最佳答案
您当前的获取类型必须是:
原文链接:https://www.f2er.com/mysql/433467.htmlPDO::FETCH_BOTH (default): returns an array indexed by both column name and 0-indexed column number as returned in your result set
鉴于您的要求,它应该是:
PDO::FETCH_ASSOC: returns an array indexed by column name as returned in your result set
fetch_style
Controls how the next row will be returned to the caller. This value must be one of the PDO::FETCH_* constants,defaulting to value of PDO::ATTR_DEFAULT_FETCH_MODE (which defaults to PDO::FETCH_BOTH).