zoukankan      html  css  js  c++  java
  • 工作中用到的 TP3.2和TP5.0 几点区别

    一、后台流程

      1).数据库操作

        TP5.0     增insert 删 delete 改update 查 find select

        TP3.2     增add 删 delete 改save 查 find select

      2).分页的显示

        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,])
         
          //页面     $this->display();
          //ajax 返回   $this->ajaxReturn($info);
      
        TP5.0
           //数据
           $this->assign(['data' => $data,'page' => $page,]);
           //页面  return $this->fetch('evaluate_index');
        
           //ajax 返回 return callback(0,'优惠门槛不能小于优惠金额');

    二、页面

      时间格式       TP3.2  <td>{$val.create_time|date="Y-m-d H:i:s",###}</td>     TP5.0   <td>{$val.create_time|date="Y-m-d H:i:s",###}</td>

      if 判断        TP3.2  <if condition="$data eq 1">1</if>     TP5.0   {if condition="$data eq 1"}1{/if} 

      switch 判断     

        TP3.2

           <switch name="vo['status']" >

          <case value="0"></case>

                 <case value="1"></case>

          <case value="2"></case>

          <case value="3"></case>

            </switch>

        TP5.0

        {switch name="val.status"}

               {case value="1"}正常{/case}

               {case value="2"}停用{/case}

               {case value="3"}已删除{/case}

          {default /} 其他

          {/switch}    

      foreach 遍历   

        TP3.2   

         <volist name="data" id="val"></volist>

         <foreach name="auth" item="v"></foreach>

           TP5.0

        {volist name="data" id="val"}{/volist}

        {foreach name="auth" item="v"}

            {if condition="$v['id'] eq $val['u_cate']"}{$v.name}{/if}

        {/foreach}

  • 相关阅读:
    三、Antd react 组件调用ref的用法获取实例
    三、gitextension 报错无法检出版本库的时候
    二、安装引入 antd
    一、React项目骨架搭建
    一、JAVA基础知识
    五、Maven创建Spring(IDEA2019-3-3)
    python爬取快手ios端首页热门视频
    接口测试之基础篇--http协议
    一些测试面试题
    性能测试一些相关的概念
  • 原文地址:https://www.cnblogs.com/wwlong/p/11586479.html
Copyright © 2011-2022 走看看