<?php class OperSerVice{ public function getResult($num1,num2,oper){ switch($oper){ case "+": return $num1+$num2; break; case "-": return $num1-$num2; break; case "*": return $num1*$num2; break; case return $num1/$num2; break; default: echo "操作符错误"; }}} ?>
时间: 2024-10-25 13:34:52