我不明白为什么这行简单的代码不起作用:
<?php
$someVariable = 0;
echo 'SomeVariable is $someVariable';
?>
它打印出“SomeVariable is $someVariable”而不是数字 0。是否有我遗漏的内容或我必须启用的某些配置选项?
那是因为您需要使用双引号。
当用单引号括起来时,php 不会将变量转换为其值
<?php
$someVariable = 0;
echo "SomeVariable is $someVariable";
?>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)