string(1) "1" ["account_type"] => string(1) "1" ["acco">
时间:2021-07-01 10:21:17 帮助过:4人阅读
$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"
}
}
如何转换成一维数组
这条数据我是用thinkphp 的select()方法得到的
用什么方法把他转换成一维数组
或是在查询出这条数据的时候不用select()方法可以用其他TP方法得到一维数组么?
$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"
}
}
如何转换成一维数组
这条数据我是用thinkphp 的select()方法得到的
用什么方法把他转换成一维数组
或是在查询出这条数据的时候不用select()方法可以用其他TP方法得到一维数组么?
直接拿
$data[0]
ThinkPhp 方法
->first();
不過你可以說說看你的需求,例如說你取得的是唯一?還是說只想一堆資料的第一筆?
用模型中的find方法
可以用foreach遍历一下
不要用thinkphp的select,那个是取多条记录用的,PHP在线执行
select()改用find()