<?php
$string = 'cup';
$name = 'coffee';
$str = 'This is a $string with my $name in it.';
echo $str;
?>不能用eval,也不能用str_replace我就想看看怎么单引号字符串变成双引号。。
$string = 'cup';
$name = 'coffee';
$str = 'This is a $string with my $name in it.';
echo $str;
?>不能用eval,也不能用str_replace我就想看看怎么单引号字符串变成双引号。。
$string = 'cup';
$name = 'coffee';
$str = "This is a $string with my $name in it.";我就想看看怎么单引号字符串变成双引号 什么意思
$name = 'coffee';
$str = <<<EOT
This is a {$string} with my {$name} in it.
EOT;
echo $str;
$name = 'coffee';
$str = <<<EOT
This is a {$string} with my {$name} in it.
EOT;
echo $str;
$string = 'cup';
$name = 'coffee';
$str = 'This is a $string with my $name in it.';
echo $str. "\n";
eval("\$str = \"$str\";");
echo $str. "\n";
?>坦白说吧,我就是想知道eval这里怎么操作的,使单引号变成了双引号,从而可以解析出变量了??
$name = 'coffee';
$str = 'This is a $string with my $name in it.';
echo $str. "\n";//$str 为 This is a $string with my $name in it.
eval("\$str = \"$str\";");
带入 $str
eval("\$str = \"This is a $string with my $name in it.\";");echo $str. "\n";
$name = 'coffee';
$str = 'This is a $string with my $name in it.';
echo $str. "\n";//$str 为 This is a $string with my $name in it.
eval("\$str = \"$str\";");
带入 $str
eval("\$str = \"This is a $string with my $name in it.\";");echo $str. "\n";
路过