如何在 PHP 变量中插入 <a href> 链接?

我有一个 PHP 文件设置如下:


if ($preference == "Vegetarian"){

   $meal = "Vegetarian"

   $gluten_free_option = "(Click here to change order to gluten-free)";

}


echo "

   <h3>Meal Choice: $meal $gluten_free_option</h3>

"

并尝试生成以下输出:


Meal Choice: Vegetarian (Click here to change order to gluten-free)

其中括号文本将链接到无麸质菜单页面。是否可以在变量 $gluten_free_option 中插入 href 链接?


沧海一幻觉
浏览 137回答 1
1回答

慕尼黑5688855

是的$gluten_free_option&nbsp;=&nbsp;"<a&nbsp;href='URL&nbsp;HERE'>(Click&nbsp;here&nbsp;to&nbsp;change&nbsp;order&nbsp;to&nbsp;gluten-free)</a>";
打开App,查看更多内容
随时随地看视频慕课网APP