【发布时间】:2014-12-25 04:34:37
【问题描述】:
我有以下代码:
$name = "<test>";
$msg = "Hi $name Hope your feeling well today";
print_r ($msg);
问题是,它会打印Hi Hope your feeling well today 并跳过$name
当我这样尝试时:
$name = "<test>";
$msg = "Hi ".$name." Hope your feeling well today";
print_r ($msg);
它也打印了同样的内容。
当我尝试它时:
$name = "<test>";
$msg = 'Hi $name Hope your feeling well today';
print_r ($msg);
它打印了Hi $name Hope your feeling well today
我需要一个解决方案,以便以 < 或任何其他 PHP 相关代码开头的变量 $name 将按原样打印。
【问题讨论】: