public function index(){
if(IS_POST){
$Search=new \Home\Model\OrderModel();
$result=$Search->Search();
$count =count($result);
$Page =new \Think\Page($count,20);
$map['brush']=I('post.brush');
$starttime=strtotime(I('post.starttime'));
$endtime=strtotime(I('post.endtime'));
$map['datetime']= array(array('gt',$starttime),array('lt',$endtime)) ;
foreach($map as $key=>$val) {
$Page->parameter .= "$key=".urlencode($val).'&';
var_dump($Page->parameter);
}
$page = $Page->show();
$list = $result;
$this->assign("count",$count);
$this->assign("page", $page);
$this->assign("list", $list);
}
$this->display();
}这是模型中的public function search(){
$order = M("order");
$condition['brush'] = I('post.brush');
$starttime=strtotime(I('post.starttime'));
$endtime=strtotime(I('post.endtime'));
$condition['datetime']= array(array('gt',$starttime),array('lt',$endtime)) ;
$result=$order->where($condition)->select();
return $result;
}因为我时间是一个时间段,请问怎么才可以搜索。还有。我控制器那边如果弄成不再次获取他们的值,怎么去简写呢?求大神帮忙 最佳答案