2018-02-05生成唯一订单号//生成唯一订单id $order_id = date("Ymd").uniqid().mt_rand(0,100); date("Ymd") ;//年月日 uniqid();//随机数 mt_rand(0,100);//1-100的随机数#订单
2018-01-27循环出分类再把分类下的商品循环出来控制器 sort_list---查出分类 url_list---分类表与商品表联查 HTML //循环分类 {{$vo1.name}} //循环商品 //判断分类id与商品里的分类是否相等,相等则输出 {{$vo2.uname}} 双循环#控制器
2018-01-26分享两个截取字符串已封装好的函数函数1 // 截取字符串函数 function subtext($text, $length) { if(mb_strlen($text, 'utf8') > $length) return mb_substr($text, 0, $length, 'utf8').'...'; return $text; } 函数2 //函数解释: //msubstr($s
2018-01-25tp3.2数据更新(适用于记录登录次数) $res1 = $user_coupon->where("user_id=$user_id")->setInc('num',$num); 相加相减使用 $User = M("User"); // 实例化User对象 $User->where('id=5')->setInc('score',3); // 用户的积分加3 $User->where('id=5'
2018-01-25tp3.2多表联查table方法 $Model = new \Think\Model(); $list = $Model->table('shopping_coupon AS c,shopping_user_coupon AS uc')->where('c.id = uc.coupon_id')->select(); 更多方法参考:http://www.thinkphp.cn
2018-01-25tp3.2中使用fetchSql,不执行语句tp3.2中使用fetchSql,不执行语句,只是做输出sql语句 $res_exi = $user_coupon->fetchSql()->where('user_id="'.$user_id.'" AND coupon_id="'.$id.'" ')->find(); if($res_exi){ echo "yes"; }else{ echo "no";