我在while循環中有一個按鈕,我想在其上使用引導樣式。我實際上認爲我可以替換當前的HTML按鈕代碼,但是出現錯誤:syntax error, unexpected 'form' (T_STRING), expecting ',' or ';'
。有什麼聰明的方法來做到這一點?在while循環中echo css類
while($row = $res->fetch_assoc()) {
echo "Id: " . $row["id"]. "<br>" .
"<button>Read More</button><br><br>";
}
這是按鈕,我想在我的while循環設置:
<div class="form-group">
<label class="col-md-4 control-label"></label>
<div class="col-md-4">
<button type="submit" class="btn btn-warning" >Send <span class="glyphicon glyphicon-send"></span></button>
</div>
</div>
我試圖設置引導按鈕的代碼在我的while循環是這樣的:
while($row = $res->fetch_assoc()) {
echo "Id: " . $row["id"]. "<br>" .
"
<div class="form-group">
<label class="col-md-4 control-label"></label>
<div class="col-md-4">
<button type="submit" class="btn btn-warning">Send <span class="glyphicon glyphicon-send"></span></button>
</div>
</div>
";
}
啊好吧我剛剛發現。也許我不熟悉,但如果我在我的html按鈕周圍設置'''',我會打印引導按鈕。那是對的嗎? – Mimi
正如我在下面的回答,你或者需要正確地轉義「或者你可以使用'作爲起點和終點,與'to'的不同之處在於」如果需要可以解析變量,所以最好使用 –
由於你使用雙引號在你的PHP中,你將需要在你的輸出中轉義你的html引號(比如'\「'),或者你可以選擇在html或php中使用單引號,否則你會嚴重混淆解析器,並隨處開始打開和關閉字符串;) – nomistic