Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
使用 heredoc 或 nowdoc,我如何创建 $sting?
$x_value=2; $string='$x='.$x_value.';'; exit($string); //$x=2;
PS。我知道像这样的脚本的滑坡
根据马克的评论,不应该被解析的值应该被转义:
$x_value=2; $string = <<<EOD \$x=$x_value; EOD; exit($string);