Php 拉威尔计算价格问题
我在拉维尔工作,但确实需要一些帮助。我在找打折产品的价格 “totalPrice”=>1-$request->input('折扣')*$request->input('price') (0.2是表中的折扣值) 现在上面写着1-0.2*的价格 我希望它是1-0.2*price=0.8*price你需要遵守规则 其中,您需要在Php 拉威尔计算价格问题,php,laravel,calculator,price,calculation,Php,Laravel,Calculator,Price,Calculation,我在拉维尔工作,但确实需要一些帮助。我在找打折产品的价格 “totalPrice”=>1-$request->input('折扣')*$request->input('price') (0.2是表中的折扣值) 现在上面写着1-0.2*的价格 我希望它是1-0.2*price=0.8*price你需要遵守规则 其中,您需要在(1-$request->input('discount')中包含()括号,然后将其结果相乘 就这样 'totalPrice' => ( 1 - $request->
(1-$request->input('discount')
中包含()
括号,然后将其结果相乘
就这样
'totalPrice' => ( 1 - $request->input('discount') ) * $request->input('price')
在这个等式中,系统将先进行减法运算,然后再乘以结果。我们所有人都曾经成为白痴,但不断编码让你变得很棒!上帝保佑!