问题是如何使它在我的代码中工作,因为我的代码目前不能工作。
代码:$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