我正在查看一些代码用于工作,并遇到了这一行:
eval("\$element = \"$element\";");
我真的很困惑为什么任何PHP开发人员都会编写这一行.除了为自己设置变量之外,这还有什么用途?
幸运的是,这条线的功能从未被调用过.
<?PHP
$string = 'cup';
$name = 'coffee';
$str = 'This is a $string with my $name in it.';
echo $str. "\n";
eval("\$str = \"$str\";");
echo $str. "\n";
?>
以上示例将输出:
This is a $string with my $name in it. This is a cup with my coffee in it.
http://php.net/manual/en/function.eval.php
我只是ctl c ctrl v
总结
以上是DEVMAX为你收集整理的PHP eval $a =“$a”?全部内容。
如果觉得DEVMAX网站内容还不错,欢迎将DEVMAX网站推荐给好友。