<code> $data = array(1) { [0] => array(10) { ["account_id"] => string(1) "1" ["account_type"] => string(1) "1" ["account_phone"] => string(11) "18284573042" ["account_password"] => string(32) "33863f368f1195d4e14d357bcd4aac2b" ["account_salt"] => string(20) "acfhjzHIJVW2!#^)[+.;" ["account_alipay"] => string(1) "0" ["account_createtime"] => string(1) "0" ["account_cash"] => string(1) "0" ["account_name"] => string(9) "汪昌宁" ["account_isdelete"] => string(1) "0" } }</code>
How to convert it into a one-dimensional array
I got this data using the select() method of thinkphp
How to convert it into a one-dimensional array
Or when querying this data Can I use other TP methods to get a one-dimensional array without using the select() method?
<code> $data = array(1) { [0] => array(10) { ["account_id"] => string(1) "1" ["account_type"] => string(1) "1" ["account_phone"] => string(11) "18284573042" ["account_password"] => string(32) "33863f368f1195d4e14d357bcd4aac2b" ["account_salt"] => string(20) "acfhjzHIJVW2!#^)[+.;" ["account_alipay"] => string(1) "0" ["account_createtime"] => string(1) "0" ["account_cash"] => string(1) "0" ["account_name"] => string(9) "汪昌宁" ["account_isdelete"] => string(1) "0" } }</code>
How to convert it into a one-dimensional array
I got this data using the select() method of thinkphp
How to convert it into a one-dimensional array
Or when querying this data Can I use other TP methods to get a one-dimensional array without using the select() method?
Get it directly
<code class="php">$data[0]</code>
ThinkPhp method
<code class="php">->first();</code>
But you can talk about your needs, for example, what is the only one you get? Or do you just want the first batch of information?
Use the find method in the model
You can use foreach to traverse it
Don’t use thinkphp’s select, that is for fetching multiple records, PHP executes it online
select() uses find() instead