如何在单引号和双引号中转义变量?的PHP

时间:2020-11-11 09:13:44

标签: php html

我回显了HTML输入,我无法弄清楚如何在单引号和双引号内获取变量$ coins。

echo '<form action="action.php" method="post">

      <input type="number" max="{$coins}">';

预先感谢

1 个答案:

答案 0 :(得分:0)

选项1

echo "<form action=\"action.php\" method=\"post\">

      <input type=\"number\" max=\"{$coins}\">";

选项2

echo '<form action="action.php" method="post">

      <input type="number" max="'.$coins.'">';


相关问题