执行代码 php 函数 eval()
Execute code php the function eval()
问题是如何让它按照我的代码运行,因为我的代码目前无法运行。
代码:
$v = 4667033;
$g = " $v != 0 ";
$exp = "if( \{$g}\ ){ echo 'si'; }else{ echo 'no'; }";
$micadena = $exp;
ob_start();
eval("$micadena");
$this_string = ob_get_contents();
ob_end_clean();
echo "sdsdsd >>> ".$this_string;
虽然你的问题不清楚你可以试试这个
$v = 4667033;
$g = " $v != 0 "; $exp = "if( $g ){ echo 'si'; }else{ echo 'no'; }";
$micadena = $exp;
ob_start(); eval("$micadena"); $this_string = ob_get_contents(); ob_end_clean();
echo "sdsdsd >>> ".$this_string;
输出
sdsdsd >>> si
问题是如何让它按照我的代码运行,因为我的代码目前无法运行。
代码:
$v = 4667033;
$g = " $v != 0 ";
$exp = "if( \{$g}\ ){ echo 'si'; }else{ echo 'no'; }";
$micadena = $exp;
ob_start();
eval("$micadena");
$this_string = ob_get_contents();
ob_end_clean();
echo "sdsdsd >>> ".$this_string;
虽然你的问题不清楚你可以试试这个
$v = 4667033;
$g = " $v != 0 "; $exp = "if( $g ){ echo 'si'; }else{ echo 'no'; }";
$micadena = $exp;
ob_start(); eval("$micadena"); $this_string = ob_get_contents(); ob_end_clean();
echo "sdsdsd >>> ".$this_string;
输出
sdsdsd >>> si