如题:在A页中<input type="hidden" name="hiddenField" value"$_POST['Self_Fee']+$_POST['Brand_Fee']"/>;
'Self_Fee' 和 'Brand_Fee' 均在A页面中。
B页面实现 将'Self_Fee'与'Brand_Fee'的值累加,可以通过$count = $_POST['Self_Fee']+$_POST['Brand_Fee'];来实现。
小弟在想,如果只知道“hiddenField”,而执行语句写到了value里。我们可以用
<?php
$stmp = $_POST['hiddenField']; //得到了想执行的语句$_POST['Self_Fee']+$_POST['Brand_Fee']
//如何把字符串$stmp中的代码来执行呢?
?>
'Self_Fee' 和 'Brand_Fee' 均在A页面中。
B页面实现 将'Self_Fee'与'Brand_Fee'的值累加,可以通过$count = $_POST['Self_Fee']+$_POST['Brand_Fee'];来实现。
小弟在想,如果只知道“hiddenField”,而执行语句写到了value里。我们可以用
<?php
$stmp = $_POST['hiddenField']; //得到了想执行的语句$_POST['Self_Fee']+$_POST['Brand_Fee']
//如何把字符串$stmp中的代码来执行呢?
?>
没看错的话 你是想在变量写php代码,然后取出这个变量,再执行。认为这既没必要,php也实现不了
Evaluates the string given in code_str as PHP code. Among other things, this can be useful for storing code in a database text field for later execution.
Also remember that variables given values under eval() will retain these values in the main script afterwards. 大家有没有PHP的说明是中文的函数速查手册,英文的实在是看着太麻烦了。那位好心,请发到小弟邮箱[email protected],谢谢
eval($tmp);是可以的;
但$tmp = "\$_POST['Self_Fee'];";
eval($tmp); 是不行的
还有什么方法么?类似于JAVA的CLASSFOR?
就可以了