首页 > 代码库 > PHP双引号小隐患

PHP双引号小隐患

function    test()
{
echo "hello";
}
echo "${@test()}";
echo "${@phpinfo()}";
// 原理:
$a = ‘b‘;
$b = ‘a‘;
echo $$a;


<?php
$a = ‘hello‘;
$$a = "test";
echo "${$a}";
?>  这样输出test

<?php
$a = ‘hello‘;
$$a = "test";
echo "$$a";
?>这样输出hello;

 

PHP双引号小隐患