ajax返回时用echo json_encode()
ajax返回时用echo 不用return,否则前台不显示数据 PHP
ajax返回时用echo 不用return,否则前台不显示数据 PHP
设置admin.php入口文件
//生成唯一订单id $order_id = date("Ymd").uniqid().mt_rand(0,100); date("Ymd") ;//年月日 uniqid();//随机数 mt_rand(0,100);//1-100的随机数
$this->show('');
控制器 sort_list---查出分类 url_list---分类表与商品表联查 HTML //循环分类 {{$vo1.name}} //循环商品 //判断分类id与商品里的分类是否相等,相等则输出 {{$vo2.uname}} 双循环
函数1 // 截取字符串函数 function subtext($text, $length) { if(mb_strlen($text, 'utf8') > $length) return mb_substr($text, 0, $length, 'utf8').'...'; return $text; } 函数2 //函数解释: //msubstr($s
$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'
时间转换为时间戳 strtotime(具体的时间) 即时时间戳 mktime()
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
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";