public function testMerge() { $input1 = [1, 2, 3]; $input2 = [4, 5, 6]; $this->assertEquals([1, 2, 3, 4, 5, 6], arr_merge($input1, $input2)); }
public function countHandle() { $year = I('year'); $month = I('month'); if ($month != 0) { $m['post_date'] = array('between', "{$_POST['year']}-{$_POST['month']}-0,{$_POST['year']}-{$_POST['month']}-31"); } else { $m['post_date'] = array('between', "{$_POST['year']}-0-0,{$_POST['year']}-12-31"); } $field = array('post_id', 'user_id', 'post_date', 'post_title'); $data = M('posts')->field($field)->where($m)->select(); $r = arr_merge($data); foreach ($r as $key => $value) { $g = M('user')->where(array('user_id' => $key))->find(); $r[$key]['user_login'] = $g['user_login']; $r[$key]['user_name'] = $g['user_nicename']; $r[$key]['date'] = $year . "-" . $month; } $this->r = $r; $this->display('count'); }