Several differences between the work used in TP3.2 and TP5.0

First, the back-office processes

  1) The database operation

    TP5.0

    Add insert delete delete search find select change update

    TP3.2

    Add add delete delete change save search find select

  2). Display tab

    TP5.0

    $data = db('horseman_order ho')

    ->join('horseman h','ho.hid = h.id','left')
->join('merchants_food_order o',' ho.oid = o.id','left')
->join('user u','o.uid = u.id')
->where($where)
->paginate(10,false,['query'=>request()->param()]);
  return $data;
  $page(分页) = $data->render();

    TP3.2

  $count = M('industry as i')->where($where)->count();
  $page = new Page($count,10);
  $show(分页) = $page->show();

    $data = M('industry as i')

    ->join('ysk_industry_cate as ic on ic.id = i.cid','left')
->where($where)
->field('i.*,ic.name as cname')
->limit($page->firstRow,$page->listRows)
->order('create_time desc')
->select();
  
  3).映射数据和页面
  tp3.2
  //数据
   
$this->assign([
'data'=>$data,
'page'=>$show,
'count'=>$count,
'param'=>$param,
'cate_data'=>$cate_data,
  ]);
  //页面
  $this->display();
  //ajax 返回
  $this->ajaxReturn($info);
  TP5.0
  //data
  $this->assign([
  'data' => $data,
  'page' => $page,
  ]);
  //页面
  return $this->fetch('evaluate_index');
  // ajax return return callback ( 0 , 'can not be less than the threshold of preferential discount amount' ); 

Second, page
  

 

      

 

Guess you like

Origin www.cnblogs.com/wwlong/p/11586479.html