tp5查询表结果数组 怎么去掉其中的一列? 然后把它存到另一张表中?
请教一下,像这样tp5查询表结果数组$data_play数组值跟踪:
app\common\model\Player::__set_state(array(
'auto' =>
array (
),
'update' =>
array (
),
'connection' =>
array (
),
'parent' => NULL,
'query' => NULL,
'name' => 'Player',
'table' => NULL,
'class' => 'app\\common\\model\\Player',
'error' => NULL,
'validate' => NULL,
'pk' => NULL,
'field' =>
array (
),
'readonly' =>
array (
),
'visible' =>
array (
),
'hidden' =>
array (
),
'append' =>
array (
),
'data' =>
array (
'id' => 1,
'lastip' => '25.36.21.2',
'regdate' => '2017-10-10 11:01:52',
'phone' => '1526564161',
'head' => '123',
'meili' => 888,
'jifen' => 888,
'jushu' => 99,
'shenglv' => 60,
'xingyundou' => 8000,
'xingzuan' => 6,
'level' => 'LV1',
'hua' => 200,
'email' => NULL,
'logintime' => '2017-10-09 11:26:47',
'logouttime' => '2017-10-08 11:38:42',
'logincount' => 0,
'hei' => 0,
'red' => 1,
'oldid' => 'bj1',
),
'origin' =>
array (
'id' => 1,
'lastip' => '25.36.21.2',
'regdate' => '2017-10-10 11:01:52',
'phone' => '1526564161',
'head' => '123',
'meili' => 888,
'jifen' => 888,
'jushu' => 99,
'shenglv' => 60,
'xingyundou' => 8000,
'xingzuan' => 6,
'level' => 'LV1',
'hua' => 200,
'email' => NULL,
'logintime' => '2017-10-09 11:26:47',
'logouttime' => '2017-10-08 11:38:42',
'logincount' => 0,
'hei' => 0,
'red' => 1,
),
'relation' =>
array (
),
'insert' =>
array (
),
'autoWriteTimestamp' => false,
'createTime' => 'create_time',
'updateTime' => 'update_time',
'dateFormat' => 'Y-m-d H:i:s',
'type' =>
array (
),
'isUpdate' => true,
'updateWhere' =>
array (
0 =>
array (
0 => 'exp',
1 => 'id = 1',
),
),
'failException' => false,
'useGlobalScope' => true,
'batchValidate' => false,
'resultSetType' => 'array',
'relationWrite' => NULL,
))
怎么去掉其中的一列? 然后把它存到另一张表中?
array_splice($data, 0, 1); 这样不行,因为数组不是简单的数组了。
$w = new \app\common\model\W;
$w->insert($data);
请不吝赐教,谢谢!
以下语句都不行!郁闷!
$data = array();
$data = $data_play[0]['data'];
$data = array();
$data = $data_play['data'];
我这样怎么无法输出结果?
$data = Db::table('tb_p')->where('id = 8')->select();
file_put_contents("log.txt"," data: ",FILE_APPEND);
file_put_contents("log.txt",var_export($data,true),FILE_APPEND);
$data = Db::name('tb_p')->where('id = 8')->select(); 也一样不行!
这是为什么呢? 请不吝赐教!
$data_player = $p->where("id = $id")->find();
foreach($data_player as $d=>$v){
file_put_contents("log.txt", ' d: ' . $d . ' v: ' . $v ,FILE_APPEND);
...
奇怪,log.txt没输出任何内容。 经跟踪,$data_player是有内容的,内容就是一开始的那些内容。怎么回事呢?
foreach($data_player as $d => $v){
file_put_contents("log.txt", ' d: ',FILE_APPEND);
file_put_contents("log.txt", $d,FILE_APPEND);
file_put_contents("log.txt", ' v: ',FILE_APPEND);
file_put_contents("log.txt", $v,FILE_APPEND);
写成这样还是什么都没打印出来!
请不吝赐教!