分类
PHP

可变变量

       $nums = array(1,2,3,4,5,6,7,8,9,10);
        foreach($nums as $num){
            $numberFinal = rand(1,100); //生成一个随机数
            if($numberFinal<= ${'probability' . $num}){ //根据概率算出是否获取到该优惠券
                $youhuiquan_gid_group[] = ${'youhuiquan_gid_' . $num};
            }
        }
        $probability1 =1;

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注