发布于 1970-01-01 08:00
  • 3 个回答
    • $goodsShow = Goods::where([product_id'=>$id,'name'=>$name])->first();

      2022-12-01 14:52 回答
    • 多条可以使用苏生不惑的方法
      其实单个条件可以写成

      $goodsShow = Goods::where('product_id', $id)->first();
      

      方便一些。

      2022-12-01 14:52 回答
    • 多条件的话可以这样写:

      $goodsShow = Goods::where('cate_id','=',$cate_id)
          ->where(function($query){
              $query->where('status','<','61')
                  ->orWhere(function($query){
                      $query->where('status', '91');
                  });
          })->first();

      这一段其实执行的就是where cate_id = $cate_id AND (status < 61 OR status = 91)

      2022-12-01 14:52 回答
    撰写答案
    今天,你开发时遇到什么问题呢?
    立即提问
    PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
    Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有