我想我会提供一些额外的信息,以便您理解。
在您的代码中:
$raceramps56["short"] = "My Test Product";
$leftMenu =
'<div class="leftMenuProductButton"><?PHP echo $raceramps56["short"] ?></div>';
你包括字面意思。
读一读这个。http://php.net/manual/en/language.types.string.php
当我第一次学习时,我不明白文字 ' 和双引号之间的区别,尤其是在我尝试回显内容时会引起问题。
看看这个:
<?php
echo 'this is a simple string';
echo 'You can also have embedded newlines in
strings this way as it is
okay to do';
// Outputs: Arnold once said: "I'll be back"
echo 'Arnold once said: "I\'ll be back"';
// Outputs: You deleted C:\*.*?
echo 'You deleted C:\\*.*?';
// Outputs: You deleted C:\*.*?
echo 'You deleted C:\*.*?';
// Outputs: This will not expand: \n a newline
echo 'This will not expand: \n a newline';
// Outputs: Variables do not $expand $either
echo 'Variables do not $expand $either';
?>
如果您使用 " " 而不是 ' 您将不会得到相同的输出,因为 " 将解释所有内容而不是按字面意思理解。
我希望这对您有所帮助,即使您的问题已经得到解答。