php写一个计算机出问题了,代码放下边了,求大神看一下
<?phpclassjisuan{publicfunctionjia($z1,$z2){returnz1+z2;}publicfunctionjian($z1,$z2){...
<?php
class jisuan{
public function jia($z1,$z2){
return z1+z2;
}public function jian($z1,$z2){
return z1-z2;
}public function cheng($z1,$z2){
return z1*z2;
}public function chu($z1,$z2){
return z1/z2;
}
}
$s=new jisuan();
$s1=$_POST['shu1'];
$i=$_POST['fuhao'];
$s2=$_POST['shu2'];
switch ($i){
case "+":
echo $s->jia($s1,$s2);
break;
case "-":
echo $s->jian($s1,$s2);
break;
case "*":
echo $s->cheng($s1,$s2);
break;
case "/":
echo $s->chu($s1,$s2);
break;
}
小型计算器 展开
class jisuan{
public function jia($z1,$z2){
return z1+z2;
}public function jian($z1,$z2){
return z1-z2;
}public function cheng($z1,$z2){
return z1*z2;
}public function chu($z1,$z2){
return z1/z2;
}
}
$s=new jisuan();
$s1=$_POST['shu1'];
$i=$_POST['fuhao'];
$s2=$_POST['shu2'];
switch ($i){
case "+":
echo $s->jia($s1,$s2);
break;
case "-":
echo $s->jian($s1,$s2);
break;
case "*":
echo $s->cheng($s1,$s2);
break;
case "/":
echo $s->chu($s1,$s2);
break;
}
小型计算器 展开
2016-12-10
展开全部
class jisuan{
public function jia($z1,$z2){
return $z1+$z2;
}public function jian($z1,$z2){
return $z1-$z2;
}public function cheng($z1,$z2){
return $z1*$z2;
}public function chu($z1,$z2){
return $z1/$z2;
}
}
public function jia($z1,$z2){
return $z1+$z2;
}public function jian($z1,$z2){
return $z1-$z2;
}public function cheng($z1,$z2){
return $z1*$z2;
}public function chu($z1,$z2){
return $z1/$z2;
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询