P.S. php5开始才支持oop。
a_plus_b.html
<
html
>
< head >
< title > A + B </ title >
</ head >
< body >
< form action ="a_plus_b.php" method ="POST" >
A: < input type ="text" name ="A" >< br >
B: < input type ="text" name ="B" >< br >
< input type ="submit" >< input type ="reset" >
</ form >
</ body >
</ html >
< head >
< title > A + B </ title >
</ head >
< body >
< form action ="a_plus_b.php" method ="POST" >
A: < input type ="text" name ="A" >< br >
B: < input type ="text" name ="B" >< br >
< input type ="submit" >< input type ="reset" >
</ form >
</ body >
</ html >
a_plus_b.php
<?
php
# 3个用来接收的全局变量:$_POST, $_GET, $_REQUEST
$a = $_POST [ " A " ];
$b = $_POST [ " B " ];
$c = $a + $b ;
echo $a . ' + ' . $b . " = $c " ;
?>
# 3个用来接收的全局变量:$_POST, $_GET, $_REQUEST
$a = $_POST [ " A " ];
$b = $_POST [ " B " ];
$c = $a + $b ;
echo $a . ' + ' . $b . " = $c " ;
?>