这是我的代码;
$script = $row['script'];
// $row is from database and the $row['script'] is exeactly the same with $script commented below.
// $script ="global \$timedate;\$target =\$timedate->now();return \$target;";
return eval($script);
当我取消注释 $script 时,它将正确运行。但是,如果我评论 $script 并从 $row['script'] 加载值,则 eval 会出现以下错误:
[12-May-2012 22:09:25 UTC] PHP Parse error: syntax error, unexpected $end in C:\Users\iopen\Documents\IOPEN\Project\Clients\sugarcrm\hfcrmlocal\custom\modules\iopenwf\model\IOpenAction.php(56) : eval()'d code on line 3
任何的想法?