我喜欢解决通过 post 传递的数学公式。例如。:
<form name="form1" method="post" action="">
<label for="f">Fórmula: </label>
<input type="text" name="f" id="f" value="<?=$_POST['f']?>">
<input type="submit" name="button" id="button" value="Submit">
</form>
$f = $_POST['f']; //Suppose the user typed: (A + B) * C as formula
使用通过$_POST
(A + B) * C 传递的这个公式并进行数学演算
A = 1; B = 2; C = 3;
$x = (A + B) * C // here the formula would be
$_POST[f] = (A + B) * C
echo $ x;