如何在字符串中显示“静态变量”:类似这样的
class test
{
public static $static_var = 10;
public function name()
{
echo "You have {self::$static_var}"; //You have 10
}
}
也尝试过:echo "You have {${self::$static_var}}";
但似乎也没有用,
我知道密切引用:echo "You have ".self::$static_var;
但是有没有办法用括号“{}”?