将关联数组更改为索引数组/将Zend_Table_Row_Abstract设置为非关联数组 [英] Change an associative array into an indexed array / get an Zend_Table_Row_Abstract as non-associative
问题描述
你在Stackland那里.我想知道是否存在将关联数组更改为索引数组的功能或简便方法.
Hi out there in Stackland. I was wondering if there was either a function or an easy way to change an associative array into an indexed array.
为了详细说明,我使用的是Zend框架,并且在我的站点中有一个要点,其中我取出一行SQL表作为关联数组.我已经通过在JSON中回显的方式将其传递给了javascript.但是,我注意到我可以在Firebug中看到数据库列的名称.让外人知道您的表和列的名称是一项不小的安全措施,所以我想将其更改为
To elaborate, I'm using the Zend framework, and I've got a point in my site where I take out a row of an SQL table as an associative array. I've passed it to javascript via an echoed in JSON. However, I've noticed that I can see the names of my database's columns in Firebug. Having outsiders know the names of your tables and columns is a big security no-no, so I'd like to change it from
SQLarray[user_id]
SQLarray[block_id]
SQLarray[b_price] etc.
到
SQLarray[0]
SQLarray[1]
SQLarray[2] etc.
有什么好方法吗?
也可以使Zend_Table_Abstract-> fetchAll()返回一个非关联数组,但我认为这是不可能的.感谢您的帮助!
It would also work to be able to have a Zend_Table_Abstract->fetchAll() return a non-associative array, but I don't think that's possible. Thanks for your help!
推荐答案
纯php可以吗?
$array = array_values($array);
这篇关于将关联数组更改为索引数组/将Zend_Table_Row_Abstract设置为非关联数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!