永发信息网

购物车满100减2元,200减5元 300减7元,php这个代码怎么写,脑壳都想破了。

答案:1  悬赏:70  手机版
解决时间 2021-11-17 22:35
  • 提问者网友:锁深秋
  • 2021-11-17 02:53
购物车满100减2元,200减5元 300减7元,php这个代码怎么写,脑壳都想破了。
最佳答案
  • 五星知识达人网友:冷風如刀
  • 2021-11-17 03:19
$count_price = 多少钱;//购物车总金额
if($count_price >=100 && $count_price<200)
{
$count_price = $count_price-2;
}else if($count_price>=200 && $count_price<300){
$count_price = $count_price -5;
}else if($count_price>=300){
$count_price = $count_price - 7;
}追问关键是不封顶,那我这个if语句要写多长啊!这个我早就想过了追答那你就设置一个值嘛,比如是3000,当总金额超过这个值的时候提醒用户和店主协商就可以了,懒得算了,而且也不是每个人都买超过3000的东西
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯