如何在php中回显回声?
问题描述:
我有一些基本的PHP代码:
I have some basic PHP code:
$raceramps56["short"] = "My Test Product";
$leftMenu =
'<div class="leftMenuProductButton"><?PHP echo $raceramps56["short"] ?></div>';
不会显示PHP代码,仅显示元素。我尝试过
Won't echo the PHP code, only the element. I've tried things like
<div class="leftMenuProductButton">' . <?PHP echo $raceramps56["short"] ?>. '</div>';
仅返回解析错误:解析错误,意外的'<'
所以我的问题是,如何使它工作或采取另一种方法?
So my question is, how do I either get this to work, or take another approach?
答
尝试一下
$ raceramps56 [ short] =我的测试产品;
$ leftMenu ='< div class = leftMenuProductButton>'.. $ raceramps56 [ short]。'< / div>';